[eluser]Solarpitch[/eluser]
Hi,
Just wondering if this Syntax is correct. Its just that if I put this into phpmyadmin I get the correct result of 40 being returned.
Code:
SELECT count(type) from sales where tpe = 'cash' and date = $yesterday;
However when I run it like this from my model, I just get 0. So im just wondering if the sql in the model will produce the above? I'm sure there's a way to print the SQL query to screen from the model?
Code:
function yesterday_cash_sales()
{
$yesterday = date('Ymd', mktime(0, 0, 0, date("m") , date("d") - 1, date("Y")));
$this->client->like('type');
$this->client->get_where('sales', array('type' => 'cash', 'date' => $yesterday));
$row = $this->client->count_all_results();
return $row;
}