to get single row i m using queryRow function
$SQL = //SQL QUERY
$data = Yii::app()->db->createCommand($SQL);
$result = $data->queryRow();
print_r always shows 1 even if no data-set returned by query. i want if no data-set is returned it should show 0. so can call some other function
what is the issue ?
Please check if this helps!
This will work for insert, update and delete:
execute(): performs a non-query SQL statement, such as INSERT, UPDATE and DELETE. If successful, it returns the number of rows that are affected by the execution.
For select, you could do the following:
This generates the CDbDataReader instance and CDbDataReader provides a rowCount property
$rowCount = $dataReader->rowCount;