My code is correct (I’ve been programming for 13 years), but for some reason when I use a variable in a SELECT query in the WHERE clause, I get no result. If I hardcode it, it works. How could this be? Blowing my mind…
$track = $wpdb->get_row($wpdb->prepare("SELECT tracking_id, order_id, outbound_tracking_number, return_tracking_numbers FROM wp_woocommerce_trackingnumbers WHERE order_id = %s", $o_id));
Thanks!
I think it should be (
%s
should be%d
)%s
for strings and%d
for digits and variable$o_id
sounds like an integer to me.