Help queryRow

Hello

I use this query, but when I want to print $Lab_id, it’s blank. Any idea?

$sql=“SELECT id,User_id,Lab_id from Information where book=’$book’”;

		$command=$connection->createCommand($sql);


		list($Records_id,$User_id,$Lab_id)=$command->queryRow();

What is the DB Table structure? I’m assuming that the row you’re fetching (WHERE book=’$book’) has a value in it and is not NULL. What happens if you print the returned row ($command->queryRow())? Does a value show up for column ‘Lab_id’?

it print "Array".

$sql=“SELECT id,User_id,Lab_id from Information where book=’$book’”;

$command=$connection->createCommand($sql);

list($Records_id,$User_id,$Lab_id)=$command->queryRow();

i want to execute this query one time but use the value($Records_id,$User_id,$Lab_id) many times. Any idea?

If you run print_r($command->queryRow()) or var_dump($command->queryRow()) in your code the returned value is simply "Array"?

Yes, simply "Array".

Then no rows were found.

Is book matching a valid existing value?

Problem solved.

$sql=“SELECT id,User_id,Lab_id from Information where book=’$book’”;

$command=$connection->createCommand($sql);

$row = $command->queryRow();

print $row[Lab_id];

Hmm…interesting…