WordPress.org

Forums

Can $wpdb->get_row() return integer columns as integers? (1 post)

  1. moroshko
    Member
    Posted 2 years ago #

    I use the following to get a record with specific id:

    $sql = $wpdb->prepare("SELECT * FROM my_table WHERE id = %d", $id);
    $record = $wpdb->get_row($sql, ARRAY_A);

    However, all integer columns (e.g. BIGINT) appear as string, i.e. $record['my_column'] is string rather than integer.

    Is that possible to get integer columns as integers, or I need to do the casting manually?

Topic Closed

This topic has been closed to new replies.

About this Topic