Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

cbonwp on "get_row associative array not working"

$
0
0

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 advance

function 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 all articles
Browse latest Browse all 8245

Trending Articles