$sql="select cat_id from cats where cat_link=':links'"; $command=Yii::app()->db->createCommand($sql); $dataReader=$command->query(array (':links'=>$_GET['cat']));
Page 1 of 1
query with parameters
#1
Posted 16 February 2010 - 09:42 AM
I am trying to run this code but it does not work, what is wrong?

#2
Posted 16 February 2010 - 09:45 AM
I wrote this and it worked, is this right?.
[edit]The code that worked were that
$sql="select cat_id from cats "; $command=Yii::app()->db->createCommand($sql); $dataReader=$command->query(array ('cat_link'=>$_GET['cat']));
[edit]The code that worked were that
$sql="select cat_id from cats where cat_link=:link "; $command=Yii::app()->db->createCommand($sql); $dataReader=$command->query(array (':link'=>$_GET['cat']));

Share this topic:
Page 1 of 1