
September 24th, 2003, 04:25 PM
|
|
|
|
Join Date: Apr 2007
Posts: 158
Time spent in forums: < 1 sec
Reputation Power: 3
|
|
|
paged search results
Not sure if this is a PHP or MySql question, but here goes.
I'm using a php script to page mysql search results by category. A user uses a form and selects a category to see all the listings in that category, and the result page shows 15 listings, with the next/previous links, number of listing for that category, etc., as it should. However, when you click on the "next" link, and then afterwards click on any link, it brings up all of the listings in the database, not just the ones for that category.
Here is the code, any suggestions on what is causing this?
php Code:
Original
- php Code |
|
|
|
<html> <head> </head> <body bgcolor=white link= #004679 alink=black vlink=black><center> <? require("paging_class.php"); include("dbinfo.inc.php"); $paging=new paging(15,5); $paging->db("localhost","$username","$password","$database"); $paging->query("select * from links WHERE category LIKE '%$list%' ORDER BY name ASC"); echo "<table width=380 border=0 cellpadding=8 cellspacing=0>"; echo "<td valign=top align=center><font face=verdana size=2 color=#004679><b>"; $page=$paging->print_info(); echo "<p>Listings $page[start] - $page[end] of $page[total]<br> [Total of $page[total_pages] Pages]<hr>n"; echo "</b></font></td></tr>"; while ($result=$paging->result_assoc()) { echo "<td><font face=verdana size=1 color=black><b>"; echo $paging-> print_no(). " : "; echo "$result[name]<br>n"; echo "<a href=$result[web] target=_parent>Link to Website</a><br>n"; echo "$result[description]<br>n"; } echo "<hr>". $paging-> print_link(); ?> </body></html>
This is online now, if viewing it actually working will help someone figure it out.
<mdhwebdesign.com/tstop/index.shtml>View Online</a>, look under the business directory and search the categories.
Thnx
|