Dear all,,

I have a problem with searching and pagination...
For searching i use SQL_CALC_FOUND_ROWS and Inner Join .. the problem is that when i use the $limit variable in the end of the search query.. it is not working properly...


I am giving the query below..

$query_data=" SELECT SQL_CALC_FOUND_ROWS * FROM reg_personal inner join reg_english_level inner join reg_services inner join reg_status ON(reg_personal.personal_code=reg_english_level.english_code AND reg_english_level.english_code=reg_services.services_code AND reg_services.services_code=reg_status.status_code)WHERE $query_string $limit";

Thanks in advance..

Try adding this small feature, just to check if the page number isn't already zero.

$limit = 'LIMIT' . (($pageno == 0) ? '0' : ($pageno-1)*$rows_per_page) . ',' . $rows_per_page;

It could be that mysql is getting an invalid number.

I am getting the correct result as the query ....
But the problem is that when i try to view the next or previous page .. the all records are displayed in there order they exist in the db. That is.. it will quit from the query condition when i click next or previous link!!!!!!

For example ...

There r 16 females in my db
and i set the rows_per_page as 15.
if i give the condition for all female records.. then first the query will work properly and display the second page having 1 record with it..

The problem starts here..
If i click the previous link for seeing the rest of the 15 records.. then the previous page will display all records regardless of male or female..

How is this happend. I am not getting any idea..
Please help me.

i have a pagination script i made about 6 months ago for someone on daniweb. i can send it to you and you can modify it to work for you.