Support » Plugins » Can $wpdb->get_row() return integer columns as integers?

  • 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?

  • The topic ‘Can $wpdb->get_row() return integer columns as integers?’ is closed to new replies.