Hello,
I am facing one problem of pagination.
Actually I did pagination successfully,but problem is getting by where clause
I used SELECT query with WHERE clause.Using input field.
Now the problem is that "while choosing the page of that pagination I have to again choose that input fields which used in the where clause.
Here is my piece of code :
Collapse | Copy Code
I'm seeing some things that just don't look right in that code. For example the query to get the total records is not using the WHERE parameter to get the correct record total based upon the filter criteria. But the solution to your problem is simple. If the user passes data to be used to filter the records then you need to same those parameters and use them on subsequent page loads. Here is some sample code you can try:
PHP Code:
<?php
session_start();
$records_per_page = 10;
function parseOptions($opt) { $opt = mysql_real_escape_string($opt); return "'{$opt}'"; }
//Run query to get records for selected page $LIMITSTART = ($pageno - 1) * $records_per_page; $query = "SELECT date, mobno, city, state, type, telecaller FROM import {$WHERE} GROUP BY mobno,telecaller ORDER BY date DESC LIMIT $LIMITSTART, $records_per_page"; $result = mysql_query($query);
Bookmarks