Categories > TinyButStrong general >

Using SQL_CALC_FOUND_ROWS or FOUND_ROWS() doesn't work after mering query with Limit

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Andy
Date: 2007-09-21
Time: 19:13

Using SQL_CALC_FOUND_ROWS or FOUND_ROWS() doesn't work after mering query with Limit

Suppose my table has about 2000 rows, I use Limit keyword in mysql like below and try to get total rows in the table after using limit:

$TBS->MergeBlock("SearchPlaylist","tbssql","Select * from Table Limit 1, 10);
$row = mysql_fetch_row(mysql_query(”SELECT FOUND_ROWS()”));
$total = $row[0];

According to MySQL manual,
http://dev.mysql.com/doc/refman/5.0/en/information-functions.html#function_found-rows

This should yield a value of 2000. However, this didn't do the trick. I'm not sure if this has to do with TBS or tbssql that i'm using. Could someone help me on this? Thanks.
By: Andy
Date: 2007-09-21
Time: 19:23

Re: Using SQL_CALC_FOUND_ROWS or FOUND_ROWS() doesn't work after mering query with Limit

I found the solution. I didn't put SQL_CALC_FOUND_ROWS inside the select statement..
By: Andy
Date: 2007-09-22
Time: 20:01

Re: Using SQL_CALC_FOUND_ROWS or FOUND_ROWS() doesn't work after mering query with Limit

I used the technique on website for pagination with narbar. Thanks http://tomhenry.us/tbs3/