Seeing some strange things; help is being solicited.
I have a query, like so: (using CodeIgniter, btw)
'SELECT * FROM registers WHERE client_id='.$clid .' ORDER BY date DESC LIMIT '.$num
$num
is passed in through the function call (and it==15), and is echoing properly. But running this returns only 10 rows. If I explicitly set $num
t开发者_JS百科o 15, same thing. If I set $num
to 20, it returns 11 rows! WTF's in my dome!
Howeverstance, If I set the order to ASC
, instead of DESC
, the original query runs as expected.
The query returns the expected number of rows when run in CocoaMySQL with either sort.
Any idears?
It's returning the proper number of results. I had a clause that was preventing the rows from printing under certain conditions, and they were being met. Checked num_rows() and it was correct, so found the offending code.
$this->db->select('*');
$this->db->from('registers');
$this->db->order_by('id','DESC'); //client_id='.$clid
$this->db->limit(4); //'.$num
$query_result = $this->db->get();
$hasil = $query_result->result();
return $hasil;
精彩评论