Welcome Guest, Not a member yet? Register   Sign In
Syntax Question for Counting Results?
#1

[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;
}


Messages In This Thread
Syntax Question for Counting Results? - by El Forum - 01-05-2009, 05:18 AM
Syntax Question for Counting Results? - by El Forum - 01-05-2009, 05:29 AM



Theme © iAndrew 2016 - Forum software by © MyBB