get_row associative array not working
-
can anyone spare a minute to solve this as i’m going spare?
I call this function from within a template file. The db table is set up correctly but after the get_row the associative array $record fields ID and nrecords return the debug notice “undefined index” and field pflag contains 2 instead of 1.
thanks in advancefunction x( $dbstring, $user_id ) { global $wpdb; global $table_prefix; $tablename = $table_prefix . $dbstring; $admin = ADMINRECORD; $record = $wpdb->get_row("SELECT * FROM $tablename WHERE ID = '$admin'", ARRAY_A); if(( $record = false ) OR ( $record = null )) { return 'dberror';} if( $record['pflag'] = ITEMISFREE ) { $msg = 'db = ' . $tablename . ' user = ' . $user_id . ' admin record free item contents = '; $msg = $msg . $record['ID'] . ',' . $record['nrecords'] . ',' . $record['pflag']; return $msg;} return 'ok'; }
[Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘get_row associative array not working’ is closed to new replies.