I’m letting the user page through lists of data. I implemented it with 2 sql statements one to get the count and one to let them get the next section. I get the count to show the number of pages and let the user click on any page, such as:
<< < 1 2 3 4 5 > >> 245 Items
SELECT count(*) FROM list;
SELECT * FROM list limit "$start $rows";
I was just wondering if there was a better way. It looks inefficient, particularly since my SQL is complicated with lots of joins and conditions that I have to execute twice.
Thanks
Source: http://www.arraystudio.com/as-workshop/mysql-get-total-number-of-rows-when-using-limit.html