php links to search pages method
I am creating a program that will produce search results from a mysql database using php. The search will have 10 results per page. I am looking for methods that will create the links to different pages of the same search the very same was LinuxQuestions does in their forums. Here is the basic search code.
Thank you
// the database is already open and
// the database is selected
function simple_search($searchType)
{
$query=mysql_query("SELECT * FROM item WHERE itemType='$searchType'"); //or die("(".mysql_errno().") Error:".mysql_error());
if(!$num_rows=mysql_num_rows($query)){ // see if there are any results
print "<h2>Sorry there are no results from your search</h2>";
}else{
$num_rows=mysql_num_rows($query); //or die("(".mysql_errno().") Error:".mysql_error());
print "<h2>There are $num_rows results from your search</h2>";
get_page_string($num_rows); // here is where I want to call the function to get the string to link to the other pages
print "<table width=\"100%\" align=\"center\" border=1>\n";
while($a_row=mysql_fetch_row($query))
{
print "<tr>$a_row</tr>";
}
print "</table><br>\n";
return;
}
}
|