[thelist] next, previous pagination

amar lastname amarafzal at yahoo.com
Thu Mar 27 09:05:46 CST 2003


Got some code from a website. I can get the page to
display the number of records i want, displays the
number of pages and next link etc 

Problem is when i click on the next button, the new
records dont display. The sql query used by the
tuttorial is: 
SELECT * FROM your_table WHERE name LIKE '%". $query
."%'"); // the query. 

Mine looks like: 
$numresults = mysql_query("select * from $table_name
where job_sector = '$_POST[job_sector]' AND region =
'$_POST[region]'"); // the query. 

the code for the next linkand back link look like: 
if ($page != 0) { // Don't show back link if current
page is first page. 
$back_page = $page - $limit; 

for ($i=1; $i <= $pages; $i++) // loop through each
page and give link to it. 
$ppage = $limit*($i - 1); 
if ($ppage == $page){ 
echo("<b>$i</b>\n");} // If current page don't give
link, just text. 

if (!((($page+$limit) / $limit) >= $pages) && $pages
!= 1) { // If last page don't give next link. 
$next_page = $page + $limit; 


The problem i think is in the links, the $query
variable is whats messing its up 

Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!

More information about the thelist mailing list