I have the following query that I am using in a plugin I wrote to reach out and touch another database. I first open the new database with the
$db2 = new wpdb() call.
$query = $db2->prepare("SELECT * FROM distributor_county AS d JOIN zip_code AS z WHERE z.zip_code = '%s' AND z.county=d.county AND z.state_prefix=d.state", $postal); $myid = $db2->get_var( $query );
The postal value is set properly. When I print out the query and insert it manually into my query checker in sequel pro it comes up with the proper query result. But in this code segment it always returns NULL.
After this segment I have it writing back out to this database and it writes data just fine. I simply cannot get it to read anything, simple or complex. Am I just confused?