Jump to content

several pages for search result


fery0098

Recommended Posts

hello,

 

i have made the fallowing code that searches through my mysql database in oder to find something looks like the query that the user is looking for.

i was just wondering what should i do in order to make a second page if the results are more than 25.

in other words, if there are more than 25 row i want to have a second page and if its more than 50 i want a third page and so on.

$searchquery=$_POST['searchquery'];
$sql = "SELECT * FROM users WHERE title ILKE '%" . $letter . "%'";
$result = mysql_query($sql);
$numrows=mysql_num_rows($result);
echo  "<p align="center">" .$numrows . " results found for " . $letter . "</p>";
if ($numrows != 0)
{
?>
											<table border="1" style="border-bottom-style:inherit">
											<tr>
											<td bgcolor="#CCCCCC" style="width: 95px"><strong>image</strong></td>
											<td width="450" bgcolor="#CCCCCC"><strong>Description</strong></td>
											<td width="100" bgcolor="#CCCCCC"><strong>Book Price</strong></td>
											<td width="100" bgcolor="#CCCCCC"><strong>Asked Price</strong></td>
											</tr>

<?
while($row=mysql_fetch_array($result)){ 
?>
											<tr>
											<td style="width: 95px">
											<img src="CardsPictures/<? echo $row['cardid']; ?>.jpg" width="71" height="96" alt="Front Picture"/></td>
											<td><a href="http://www.SportsCardMovers.com/show_card.php?cardid=<? echo $row['cardid']; ?>"><? echo $row['title']; ?></a></td>
											<td><? echo $row['bookprice']?></td>
											<td><? echo $row['price']?></td>
<?
}
?>
											</tr>
											</table>
<?
}
else
   echo "Please Use another Query and Search Again";
?>

 

thank you :)

Link to comment
https://forums.phpfreaks.com/topic/217255-several-pages-for-search-result/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.