nemo
(Nemoneel)
January 24, 2011, 6:11pm
1
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();
nemo:
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’?
nemo
(Nemoneel)
January 24, 2011, 9:02pm
3
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?
nemo:
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"?
alex-w
(Pr0j3ct A1ex)
January 25, 2011, 1:07pm
6
Then no rows were found.
Is book matching a valid existing value?
nemo
(Nemoneel)
January 25, 2011, 3:08pm
7
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];