I have a simple query as follows:
$q = "SELECT * FROM blah WHERE disabled = '0'";
Now for pagination, I need to add LIMIT
to my query, so:
$q = "SELECT * FROM blah WHERE disabled = '0' LIMIT 10,20";
And still, I want to know about the number of all rows with mysql_num_rows
, but in the above query it is always 10, since I'm limiting the results, so for the number of all rows I need to do the same query again without LIMIT
statement.
And it's somehow stupid to run the same query twice to just get the number of all rows, anybody has a better solution?
Thanks