I've written the code below, only i've managed to loose a book which showed me how to limit the results to 10 pages per page. And for the result of the result to span over other pages numbers 1.2.3. etc. Does anyone have the code for this?
My current PHP script is below.
<?php
if (
isset($_POST['keyword']) ||
isset($_POST['propertytype']) ||
isset($_POST['rent_min']) || isset($_POST['rent_max']) ||
isset($_POST['bedrooms_min']) ||
isset($_POST['bedrooms_max']))
{
$mysqldb = new mysqli("localhost", "user", "password", "database");
$field = $_POST['propertytype'];
$rent_min = $_POST['rent_min'];
$rent_max = $_POST['rent_max'];
$bedrooms_min = $_POST['bedrooms_min'];
$bedrooms_max = $_POST['bedrooms_max'];
if (
isset($_POST['keyword']) ||
isset($_POST['propertytype']) ||
isset($_POST['rent_min']) ||
isset($_POST['rent_max']) ||
isset($_POST['bedrooms_min']) ||
isset($_POST['bedrooms_max'])) {
$result= $mysqldb->query("SELECT Property_Ref, User_Name, Property_Details, To_Rent_Price FROM to_rent WHERE City= '$keyword'");
}
else {
echo "Invalid search criteria has been entered";
}
if ($result->num_rows > 0 ) {
echo "<table width=\"620\" height=\"306\" border=\"0\"> ";
//table header
while ($row = $result ->fetch_object()) {
//make row clickable using javascript
echo "<tr onmouseover=\"this.style.background='white';this.style.cursor='pointer'\"
onmouseout=\"this.style.background='white';\"
onclick=\"location.href='details.php?classified_id=" . $row->Property_Ref . "'\">
<th align=\"left\" width=\"170\" height=\"\" scope=\"col\"><span class=\"style17\">Monthly rent £" . $row->To_Rent_Price . "</span></th>
<th align=\"right\" width=\"440\" scope=\"col\"><span class=\"style18\">Ref:" . $row->Property_Ref . "</span></th>
</tr>
<tr onmouseover=\"this.style.background='white';this.style.cursor='pointer'\"
onmouseout=\"this.style.background='white';\"
onclick=\"location.href='details.php?classified_id=" . $row->Property_Ref . "'\">
<td height=\"\"></td>
<td><table width=\"439\" height=\"\" border=\"0\">
<tr onmouseover=\"this.style.background='white';this.style.cursor='pointer'\"
onmouseout=\"this.style.background='white';\"
onclick=\"location.href='details.php?classified_id=" . $row->Property_Ref . "'\">
<th align=\"left\" width=\"433\" scope=\"col\"><span class=\"style18\" align:\"left\">" . $row->Property_Details . "</span></th>
</tr>
</table>
<table width=\"439\" height=\"\" border=\"0\">
<tr onmouseover=\"this.style.background='white';this.style.cursor='pointer'\"
onmouseout=\"this.style.background='white';\"
onclick=\"location.href='details.php?classified_id=" . $row->Property_Ref . "'\">
<th align=\"right\" width=\"433\" height=\"\" scope=\"col\"><span class=\"style18\">Advertised by:" . $row->User_Name . "</span></th>
</tr></table></td>
</tr>"
;
}
echo "</table><br /><br /><br />"; //close table
} else {
echo "No results found.";
}
}
?>