I’m building some Sql queries.
So far all is working fine up until I need to compare a variable to a string.
Here is my function with the query:
public function countCanceled()
{
$week=Person_Event::model()->weekByDate();
$week_id=$week->id;
$datalogin=mysqli_connect(//connect is working fine);
$sql ="SELECT id
FROM tbl_event
WHERE week_id=8 AND status_id='canceled'
";
$query = mysqli_query($datalogin, $sql);
$numrows = mysqli_num_rows($query);
return $numrows;
}
Now , I clearly have one event with canceled status, and I ran the same query in MySql server and the result of 1 was given, so why in Yii it doesn’t work?
(tried to switch "=" with "like" , made no difference)
edited: yes , I can use Yii’s query here , but I have more complicated queries where I still need to compare string
Thanks,
Mark.