Using the following code:
$sql = "SELECT * FROM” . $aDatabaseSettings[‘table’] . “
= '" . $iBookingId . "' ORDER BYid` DESC LIMIT 1;”;
$aRecord = $wpdb->get_row($sql,ARRAY_A);
if( is_array($aRecord)) error_log(“YES I AM AN ARRAY”);
error_log(“aRecord sql: “.$sql);
As you can see I am trying to debug already. The thing is that the sql var returns a query which works perfectly when executing in phpmyadmin. So although this query is correct the get_row returns NULL. Also added global wpdb; before this code.
I am searching like crazy but can’t seem to find the problem.
Probably simple and stupid problem but need someone who can send me into the right direction to solve this.
Hoping on some advice.
- The topic ‘WPDB get row problem’ is closed to new replies.