Functions.php issue Sql Query
-
I have a sql query that returns no data. I have made these queries 1000’s of times. I am hoping for a little input here as our functions file is over 3000 lines long.
Why would the first query not function but the second one does?
This query returns a blank result (I have MANY queries that do work with the same format (” around the variables)):
$companyid = $wpdb->get_var($wpdb->prepare(“SELECT business_id FROM $usertable WHERE $id = %d”, $uid));
This query returns the correct result (removed the ” around the variables):
$companyid = $wpdb->get_var($wpdb->prepare(“SELECT business_id FROM ‘$usertable’ WHERE ‘$id’ = %d”, $uid));
The topic ‘Functions.php issue Sql Query’ is closed to new replies.