I get my results when I search kul. I paged my search results but now all my pages come blank when I click the page number to navigate to. I can't navigate from page one or back to page ,1plz help.
here is my code
----------------------CODE--------------------------
<?php
$output = '';
# used in pagination--------------------
$per_page = 2 ;
#---------------------------------------
if (isset($_POST['search']) and isset($_POST['search2']))
{
$searchq = $_POST['search'];
$searchq = preg_replace("#[^0-9a-z]#i","",$searchq);
$searchq2 = $_POST['search2'];
$searchq2 = preg_replace("#[^0-9a-z]#i","",$searchq2);
# used in pagination--------------------
$pages_query = mysql_query("SELECT COUNT('id') FROM provider_info "); //counting the number of records in a search
$pages = ceil(mysql_result($pages_query, 0) / $per_page);
$page = (isset($_GET['page'])) ?(int)$get['GET'] :1;
$start = ($page - 1) * $per_page;
#---------------------------------------
$query = mysql_query("SELECT * FROM provider_info WHERE(Business_Name LIKE '%$searchq%'AND Services LIKE '%$searchq2%')OR (Address_Ln1 LIKE '%$searchq%'AND Services LIKE '%$searchq2%')OR (Suburb LIKE '%$searchq%'AND Services LIKE '%$searchq2%')OR (Town LIKE '%$searchq%'AND Services LIKE '%$searchq2%') LIMIT $start,$per_page") or die("Could not search");
$pages_query = mysql_num_rows($query);
if ($pages_query ==0)
{
$output = 'There were no search results found';
} else
{
while($row = mysql_fetch_assoc($query))
{
$bName = $row ['Business_Name'];
$aAddress_Ln1 = $row ['Address_Ln1'];
$cContact_No = $row['Contact_No'];
$sSuburb = $row['Suburb'];
$tTown = $row['Town'];
$lLink = $row['Link'];
$dDescription = $row['Description'];
$pPicture = $row['Picture'];
$output.= '<div>'.$bName.''.$cContact_No.''.$aAddress_Ln1.''.$sSuburb.''.$tTown.''.$lLink.''.$dDescription.''.$pPicture.'</div>';
echo "
<table border=1 cellspacing =5>
<tr><td colspan =6 align = center><h2>{$bName}</h2></td></h2> </tr>
<tr><td rowspan = 6 width = 300>I am going to place an image here</td><td width = 90 align=right>
<b>Business Name</b></td><td width = 120>{$bName}</td><th colspan = 3 align = right colspan = 3><font color=#f90 align=right>Business Description</font></th> ".
"<tr><td align=right><b>Contact No</b></td><td>{$cContact_No}</td><td rowspan = 5 colspan = 3 align = left width = 220><font color=#f90>{$dDescription}</font></td>".
"<tr><td align=right><b>Address</b></td><td>{$aAddress_Ln1}</td>".
"<tr><td align=right><b>Suburb</b></td><td>{$sSuburb}</td>".
"<tr><td align=right><b>Town</b></td><td>{$tTown}</td>".
"<tr><td align=right><b>Email</b></td> <td>{$lLink}</td>".
"<tr><td>{$pPicture}</td>".
"<tr><td colspan = 6>__________________________________________________________________________________________________________________</td><br></table>";
# $output .= '<div>'.$bname.''.$aAddress_Ln1.'</div>';
}
# used in pagination--------------------
$prev = $page - 1;
$next = $page + 1;
if (!($page <= 1))
{
echo "<a href='results.php?page=$prev'>Prev</a> ";
}
}
if ($pages >=1)
{
for($x =1; $x <= $pages; $x ++)
{
echo ($x == $page) ? '<b><a href=?page='.$x.'>'.$x.'</a></b> ' : '<a href=?page='.$x.'>'.$x.'</a> ';
}
}
if (!($page >= $pages))
{
echo "<a href='results.php?page=$next'>Next</a> ";
}
print("$pages_query");
#---------------------------------------------------
}
?>
--------------------CODE END-------------------
Thanks now
New PHP Learner