In php-mysql, how does the count of rows returning within a SELECT query count? But if the total number was just for example 55, the result is 20 to 55 users with 20 to 40 total users! But here I am interrogating DB twice and I think it is not very good. you want
Select something like this query:
$ q = "Choose from users LIMIT 20,60"
How can I get number 35 without asking DB twice?
I am doing this now:
$ q = "Select COUNT (*) users limit of 20, 60"; $ Result = mysqli_query ($ db_connection, $ 1); $ Count = mysqli_fetch_row ($ result); $ Count = $ count [0];
I know that I can have the total number of rows without regard to LIMIT ,
using SQL_CALC_FOUND_ROWS and
FOUND_ROWS () , But this is not my case, because I want to consider the
LIMIT Thanks!
$ count = $ result- & gt; ; NUM_ROWS;
No comments:
Post a Comment