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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.