Pagination is only changing the page number, not the content - php

I have a table with a list of users and I want to create pagination for this table.
However, when I click page number 2 the page changes but not the contents of the list of users.
<?php
session_start();
require_once "connect.php";
//Database connect
$database = #new mysqli($host, $db_user, $db_password, $db_name);
//Limit users
$start = 0;
$limit = 3;
//Question to -> Database
$sql = ("SELECT * FROM users LIMIT $start, $limit");
$adds = $database->query($sql);
//Return records
$rows = mysqli_num_rows($adds);
echo "Rows found in database.. ".$rows."<br /><br />";
if(isset($_GET['id']))
{
$id=$_GET['id'];
$start=($id-1)*$limit;
}
else{
$id=1;
}
if ($rows >= 1)
{
//the beginning of the table
echo<<<END
<table width="1000" align="center" border="1" bordercolor="#d5d5d5" cellpadding="0" cellspacing="0">
<tr>
<td width="50" align="center" bgcolor="e5e5e5"></td>
<td width="50" align="center" bgcolor="e5e5e5">IDUsera</td>
<td width="20" align="center" bgcolor="e5e5e5">NazwaUsera</td>
<td width="20" align="center" bgcolor="e5e5e5">EmailUsera</td>
<td width="20" align="center" bgcolor="e5e5e5">DataRejestracji</td>
<td width="20" align="center" bgcolor="e5e5e5">Indetyfikator grupy</td>
</tr>
<tr>
END;
}
while($score = mysqli_fetch_assoc($adds)) {
$row_score_id = $score['id'];
$row_score_user = $score['user']." ";
$row_score_register = $score['dataRes']. " ";
//continued table
echo<<<END
<td width="50" align="center"><a class="button_red" href="delete_user.php?id=''">Delete</a></td>
<td width="50" align="center">$row_score_id</td>
<td width="100" align="center">$row_score_user</td>
<td width="100" align="center"></td>
<td width="100" align="center">$row_score_register</td>
<td width="100" align="center"></td>
</tr>
END;
}
$pagnSql = ("SELECT * FROM users");
$pagnBase = $database->query($pagnSql);
$pagnRows = mysqli_num_rows($pagnBase);
$total=ceil($pagnRows/$limit);
if($id>1)
{
//Go to previous page to show previous 10 items. If its in page 1 then it is inactive
echo "<a href='?id=".($id-1)."' class='button'>PREVIOUS</a>";
}
if($id!=$total)
{
////Go to previous page to show next 10 items.
echo "<a href='?id=".($id+1)."' class='button'>NEXT</a>";
}
for($i=1;$i<=$total;$i++)
{
if($i==$id) { echo "<li class='current'>".$i."</li>"; }
else { echo "<li><a href='?id=".$i."'>".$i."</a></li>"; }
}
?>

You have to put the $start from GET
Change this
$start = 0;
To:
$start = $_GET[id];

Related

How to paginate a form in php?

I have a problem. Last time, I made a grading system for teachers. I have a form for grading teachers but I am confused on how to paginate that form. If the entries are more than 10 then it causes problems.
<form action="n.php" method="post" enctype="multipart/form-data">
<table width="642" height="215" border="10" align="left" cellspacing="0" >
<tr>
<th class="style5">Teacher ID</th>
<th width="90" class="style5">Teacher Name</th>
<th width="127" class="style5">Teacher Registration</th>
<th width="135" class="style5">Teacher Qualification</th>
<th width="92" class="style5">Teacher Subject</th>
<th width="92" class="style5">Action</th>
</tr>
<?php
include 'conn.php';
$sql = "SELECT * FROM teacher ";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while($row = $result->fetch_array()){
$id=$row['tid'];
?>
<tr>
<td height="50" align="center" class="style5"><?php echo $row['tid'];?></td>
<td align="center" class="style5"><?php echo $row['tname'];?></td>
<td align="center" class="style5"><?php echo $row['treg'];?></td>
<td align="center" class="style5"><?php echo $row['qualification'];?></td>
<td align="center" class="style5"><?php echo $row['subject'];?></td>
<td align="center"> <input type="text" name="rating[<?php echo $id; ?>]">
</td>
</tr>
<?php
}
}else{
echo "<center><p><font size=10/> No Records</p></center>";
}
$conn->close();
?><tr><td colspan="6">
<input type="submit" name="submit" value="Enter"></td></tr>
</table>
</form>
In your PHP you could define a page size:
$page_size = 10; // number of teachers per page
And start at page 1:
$page = 1;
You change your SQL to use these values:
$sql = "SELECT * FROM teacher LIMIT " . $page_size * ($page - 1) . ", " . $page_size;
Now you'll only be shown 10 teachers from page 1.
You can change your script so that the page is read from the URL /yourscript.php?page=2:
$page = isset($_GET['page']) ? $_GET['page'] : 1; // take from query string or default to 1
Next step is to insert next and prev link in your html:
<?php
$next = $page + 1;
$prev = $page - 1 > 0 ? $page - 1 : 1;
echo "<a href='?page=$prev'>prev page</a>";
echo "<a href='?page=$next'>next page</a>";
You can improve your scripts by checking how many pages there is using a count of teacher records
$pages = ceil(count($teachers) / $page_size);
I think you can take it from here.
UPDATE: I've merged my suggestions with your code:
<form action="n.php" method="post" enctype="multipart/form-data">
<table width="642" height="215" border="10" align="left" cellspacing="0">
... your table stuff ...
<?php
include 'conn.php';
$page_size = 10;
// Get total pages
$sql = "SELECT COUNT(*) as cnt FROM teacher";
$result = $conn->query($sql);
$teacher_count = $result[0]["cnt"]; // I'm unsure how you DB class works;
$pages = ceil($teachers / $page_size);
$page = isset($_GET['page']) ? $_GET['page'] : 1; // take from query string or default to 1
$next = $page + 1 > $pages ? $pages : $page + 1;
$prev = $page - 1 > 0 ? $page - 1 : 1;
$sql = "SELECT * FROM teacher LIMIT " . $page_size * ($page - 1) . ", " . $page_size;
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while($row = $result->fetch_array()){
$id=$row['tid'];
?>
<tr>
<td height="50" align="center" class="style5"><?php echo $row['tid'];?></td>
<td align="center" class="style5"><?php echo $row['tname'];?></td>
<td align="center" class="style5"><?php echo $row['treg'];?></td>
<td align="center" class="style5"><?php echo $row['qualification'];?></td>
<td align="center" class="style5"><?php echo $row['subject'];?></td>
<td align="center"> <input type="text" name="rating[<?php echo $id; ?>]">
</td>
</tr>
<?php
}
}else{
echo "<center><p><font size=10/> No Records</p></center>";
}
$conn->close();
?><tr><td colspan="6">
<input type="submit" name="submit" value="Enter"></td></tr>
</table>
<?php
if ($next > 1) {
echo "<a href='?page=$prev'>prev page</a>";
}
if ($prev > 0 && $page !== 1) {
echo "<a href='?page=$next'>next page</a>";
}
?>
</form>

Display products of particular vendor in Admin Panel

I have a basic admin panel where I can see all the vendors and all the products that have been added. In the vendors page, I want to add a link which when clicked on would display/add/edit only the products for that vendor. Any leads on how this can be done?
************ EDIT **************
This is how my products page looks like. This page displays all the products.
<?php
$sno=$pagination->getLimit() + 1;
$sql2 = $sql1." limit " . $pagination->getLimit() . ", ". $rowsperpage;
$res2 = #mysql_query($sql2, $connection) or die("failed");
$i = 1;
$c=1;
$k=0;
while($res=mysql_fetch_array($res2))
{
?>
<tr <?php if($k==0) { echo 'class=""'; } else { echo 'class="row_color"'; } ?> id="row<?php echo $i;?>">
<td class="table_text"><?php echo $sno; ?>.</td>
<td class="table_text" style="line-height:12pt;">
<?php
if($res['off_status']=='N')
{
?>
<span style="padding-left: 0px;font-weight:bold;color:#E8E8E8;"><?php echo $res['Name']; ?></span>
<?php
}
else
{
?>
<?php echo $res['Name']; ?>
<?php
}
?>
</td>
<td class="table_text" style="line-height:12pt;">
<?php
$rest_name = mysql_query("SELECT * FROM `restaurants` WHERE `RestID`='$res[RestID]'");
$res_fet = mysql_fetch_array($rest_name);
if($res['off_status']=='N')
{
?>
<span style="padding-left: 0px;font-weight:bold;color:#E8E8E8;"><?php echo $res_fet['Name']; ?></span>
<?php
}
else
{
?>
<?php echo $res_fet['Name']; ?>
<?php
}
?>
</td>
<td class="table_text" style="line-height:12pt;"> <?php
if($res['off_status']=='N')
{
?>
<span style="padding-left: 0px;font-weight:bold;color:#E8E8E8;"><?php echo date('d-m-Y',strtotime($res['StartDate']));?></span>
<?php
}
else
{
?>
<?php echo date('d-m-Y',strtotime($res['StartDate']));?>
<?php
}
?> </td>
<td class="table_text" style="line-height:12pt;"><?php
if($res['off_status']=='N')
{
?>
<span style="padding-left: 0px;font-weight:bold;color:#E8E8E8;"><?php echo date('d-m-Y',strtotime($res['ExpiryDate']));?></span>
<?php
}
else
{
?>
<?php echo date('d-m-Y',strtotime($res['ExpiryDate']));?>
<?php
}
?></td>
<td class="table_text"><table width="68" height="68" border="0" cellpadding="0" cellspacing="0" bgcolor="#ffebc1">
<tr>
<td align="center"><?php
if($res['Image'] != "")
{
?>
<img src="../images/offers/thumb/<?php echo $res['Image']; ?>" border="0" />
<?php
}
else
{
?>
<img src="../images/no_image.jpg" width="88" height="76" border="0" />
<?php
}
?> </td>
</tr>
</table></td>
<td align="center" class="table_text"><img src="images/icon/level.png" width="47" height="43" border="0" /></td>
<td align="center" class="table_text"><img src="images/link.png" alt="" width="47" height="43" border="0" /></td>
<td align="center" class="table_text"><img src="images/icon/edit_icon.gif" width="16" height="15" border="0" /></td>
<td align="center" class="table_text"><img src="images/icon/view_icon.gif" width="16" height="16" border="0" /></td>
<?php
if($res['off_status']=='Y')
{
?>
<td align="center" class="table_text">Active</td>
<?php
}
else
{
?>
<td width="15%" align="center" class="table_text"> Inactive</td>
<?php
}
?>
<td width="14%" align="center" class="table_text"><img src="images/del.png" width="16" height="15" border="0" /></td>
</tr>
<?php
$c++;
$i++;
$k++;
$sno++;
if($k==2)
{
$k=0;
}
}
?>
<input type="hidden" name="acount" id="acount" value="<?php echo $i-1; ?>">
</table>
This is how I've called the link to the above mentioned page:
<?php
$sel=mysql_query("select * from offers where OfferID='".$id."'") or die(mysql_error());
$fet=mysql_fetch_array($sel);
$rest=mysql_query("select * from restaurants where RestID='".$fet['RestID']."'") or die(mysql_error());
$restfet=mysql_fetch_array($rest);
$dd= $fet['Links'];
$rest_id=$fet['RestID'];
$sql_mlink=mysql_query("select * from offers where off_status='Y' and OfferID!='".$id."' and RestID='".$rest_id."' order by OfferID asc") or die(mysql_error());
$sql_query = mysql_query("SELECT * FROM offers where RestID='".$res['RestID']."'");
$row = mysql_fetch_array($sql_query);
//$res_count=mysql_num_rows($row);
$sy = mysql_query("SELECT * FROM offers where RestID='".$res['RestID']."' and status='Y'");
$res_count=mysql_num_rows($sy);
$rw = mysql_fetch_array($sy);
?>
<td class="table_text">
Menu
</td>
You should be able to achieve this quite easily using php get and adjusting you're SQL slightly.
Add the vendor number/escaped name to the end of links to this page... e.g.:
<a href='this-page.php?vendor=vendor-1'>vendor 1</a>
Then at the beginning of the page check if there was a vendor set and if so, create some extra sql for the end of your statements. If not leave the extra sql variable blank so nothing is added:
if(!empty($_GET['vendor']))
{
$extra_sql = " AND vendor = ".$_GET['vendor'];
}
else
{
$extra_sql = "";
}
Then add the $extra_sql variable to the end of your existing SQL:
$rest=mysql_query("select * from restaurants where RestID='".$fet['RestID']."'".$extra_sql) or die(mysql_error());

trying to select a certain category from database

im a real newbie when it comes to sql but im trying to pick up the pieces of my friends site... It all seems to be working fine apart from the left hand navigation to certain categories.
This is the site: http://tyresinwigan.co.uk/new/
The individual manufacturers should point to each manufacturer direct but they seem to be listing the results for all manufacturers.
Here is the code from the search.php:
<?php
require_once('const.php');
$link = dbConnect();
$manufacturer_id = 0;
$name = '';
if (isset($_GET['make']) && is_numeric($_GET['make'])) {
$manufacturer_id = (int) $_GET['make'];
}
$query = "SELECT manufacturer_name FROM manufacturer_tbl WHERE manufacturer_id = $manufacturer_id";
$result = false;
$result = #mysql_query($query, $link);
if (($result) && (#mysql_num_rows($result) > 0)) {
$row = #mysql_fetch_array($result, MYSQL_ASSOC);
$name = stripslashes($row['manufacturer_name']);
}
$query = "SELECT *,
v.vehicle_id AS vehicle_id_alias
FROM vehicle_tbl AS v
LEFT JOIN image_tbl AS i ON v.vehicle_id = i.vehicle_id
GROUP BY v.vehicle_id
HAVING v.manufacturer_id = $manufacturer_id";
$offers = false;
$offers = #mysql_query($query, $link);
$items = 0;
if ($offers) $items = mysql_num_rows($offers);
function nextOffer() {
global $offers;
global $items;
$items --;
if ($offers && ($row = mysql_fetch_array($offers))) {
if (! isset($row['image_name'])) { // no image
$image = 'images/noimagesml.jpg';
} else {
$image = 'images/vehicles/sml/'.stripslashes($row['image_name']);
}
$title = stripslashes($row['manufacturer_name']).' '.stripslashes($row ['vehicle_model']);
$price = number_format((float) $row['vehicle_price_pcm'], 2);
$id = (int) $row['vehicle_id_alias'];
echo '<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="contenthead"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="11" height="40" align="left" valign="top"><img src="images/featre_left_hd.gif" width="11" height="23"></td>
<td width="100%" align="left" valign="middle" class="contenthead">'.$title.'</td>
<td width="11" height="40" align="right" valign="top"><img src="images/featre_rght_hd.gif" width="11" height="23"></td>
</tr>
</table></td>
</tr>
<tr>
<td class="contentpane"><table width="100%" border="0" cellspacing="5" cellpadding="0">
<tr>
<td align="center" valign="middle"><img src="'.$image.'" width="100" height="58" class="bordered" alt="'.$title.'"></td>
</tr>
<tr>
<td align="center" valign="top" class="princing">from just &pound'.$price.' pcm</td>
</tr>
<tr>
<td align="right" valign="middle"><img src="images/more_butt.gif" width="54" height="20" border="0"></td>
</tr>
</table></td>
</tr>
</table>';
} else {
echo ' ';
}
}
?>
Change:
$query = "SELECT * FROM vehicle_tbl LEFT JOIN image_tbl ON vehicle_tbl.vehicle_id = image_tbl.vehicle_id
WHERE vehicle_tbl.manufacturer_id = $manufacturer_id
GROUP BY vehicle_tbl.vehicle_id";
to:
$query = "SELECT * FROM vehicle_tbl LEFT JOIN image_tbl ON vehicle_tbl.vehicle_id = image_tbl.vehicle_id
GROUP BY vehicle_tbl.vehicle_id
HAVING vehicle_tbl.manufacturer_id = $manufacturer_id";
You are looking at the wrong query. The problem isnt in the left menu, but the query on the resulting page. You need to look at that one, and make sure it is formatted properly.

SQL Help - Newbie

I'm picking up the pieces for a friend. His website used to work and pull featured products from his database, but it doesn't seem to be working. Its just showing the Error!!
Any help would be appreciated.... I'm not really up to date with SQL.
Here's the code:
<?php
require_once('const.php');
$link = dbConnect();
$query = "SELECT *
FROM vehicle_tbl, manufacturer_tbl
LEFT JOIN image_tbl ON vehicle_tbl.vehicle_id = image_tbl.vehicle_id
WHERE vehicle_tbl.manufacturer_id = manufacturer_tbl.manufacturer_id AND
vehicle_tbl.vehicle_feature2 = '1'
GROUP BY vehicle_tbl.vehicle_id
ORDER BY RAND()
LIMIT 1";
$result = false;
$result = #mysql_query($query, $link);
$fmain = false;
if (($result) && (#mysql_num_rows($result) > 0)) {
$fmain = #mysql_fetch_array($result, MYSQL_ASSOC);
#mysql_free_result($result);
}
$query = "SELECT *
FROM vehicle_tbl, manufacturer_tbl
LEFT JOIN image_tbl ON vehicle_tbl.vehicle_id = image_tbl.vehicle_id
WHERE vehicle_tbl.manufacturer_id = manufacturer_tbl.manufacturer_id AND
vehicle_tbl.vehicle_feature1 = '1'
GROUP BY vehicle_tbl.vehicle_id
ORDER BY RAND()
LIMIT 6";
$offers = false;
$offers = #mysql_query($query, $link);
function nextOffer() {
global $offers;
if ($offers && ($row = mysql_fetch_array($offers))) {
if (! isset($row['image_name'])) { // no image
$image = 'images/noimagesml.jpg';
} else {
$image = 'images/vehicles/sml/'.stripslashes($row['image_name']);
}
$title = stripslashes($row['manufacturer_name']).' '.stripslashes($row['vehicle_model']);
$price = number_format((float) $row['vehicle_price_pcm'], 2);
$id = (int) $row['vehicle_id'];
echo '<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="contenthead"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="11" height="40" align="left" valign="top"><img src="images/featre_left_hd.gif" width="11" height="23"></td>
<td width="100%" align="left" valign="middle" class="contenthead">'.$title.'</td>
<td width="11" height="40" align="right" valign="top"><img src="images/featre_rght_hd.gif" width="11" height="23"></td>
</tr>
</table></td>
</tr>
<tr>
<td class="contentpane"><table width="100%" border="0" cellspacing="5" cellpadding="0">
<tr>
<td align="center" valign="middle"><img src="'.$image.'" width="100" height="58" class="bordered" alt="'.$title.'"></td>
</tr>
<tr>
<td align="center" valign="top" class="princing">from just &pound'.$price.' pcm</td>
</tr>
<tr>
<td align="right" valign="middle"><img src="images/more_butt.gif" width="54" height="20" border="0"></td>
</tr>
</table></td>
</tr>
</table>';
} else {
echo 'Error!!';
}
}
?>
Display mysql errors like this:
mysql_query($query, $link) or die(__FILE__ . ' Line ' . __LINE__ . ': ' . mysql_error());
This should help you debug.
P.S. the mysql_* functions are deprecated - http://php.net/manual/en/mysqlinfo.api.choosing.php

mysql results error on php

hello below is my code for a query with submit from.. the no of rows are correctly count and show in the page and the result rows are not show in my page and show "No results found, please search again", i cant find the error on my code, can anyone help to find it..
<?
### DEBUG
$debugP = 0 ;
### END DEBUG
include 'db_connector.php';
require_once('myfunctions.php');
include('header.php');
#defauts
$maxRows_p = 10;
$pageNum_p = 0;
if (isset($_GET['pageNum_p'])) {
$pageNum_p = $_GET['pageNum_p'];
}
$startRow_p = $pageNum_p * $maxRows_p;
$limit = ' LIMIT '.$startRow_p.', '.$maxRows_p;
## Start building sql for GET varables for advanced search
###Add city
if(isset($_REQUEST['city']) && ($_REQUEST['city'] != ''))
$search[] = ' city = "'.$_REQUEST['city'].'"';
###Add State
if(isset($_REQUEST['district']) && ($_REQUEST['district'] != ''))
$search[] = ' district = "'.$_REQUEST['district'].'"';
###Add lot size
if(isset($_REQUEST['lot_size']) && ($_REQUEST['lot_size'] != ''))
$search[] = ' perches >= '.$_REQUEST['lot_size'];
$search[] = ' availibility = "0" ';
###implode to search string on ' and ';
$searchStr = #implode(' and ',$search);
$sql = 'select * FROM properties WHERE status="1" and'; ###status=1 and
$sql .= $searchStr;
###Add column sorting
if($_REQUEST['sort'] != '')
$sort = ' order by added asc ';
else
$sort = $_REQUEST['sort'];
### DEBUG
if($debugP) echo 'Advanced Search Sql<hr>'.$sql;
$error['Results'] = 'No results found, please search again';
###}
### Finished Building search sql and execting #####
$sql_with_limit = $sql . $sort . $limit;
if($debugP)
echo "<hr>Property Search with Limit SQL: $sql_with_limit";
###Perform search
$searchResults = mysql_query($sql.$sql_with_limit);
### BUILD OUTPUT ####
if (isset($_GET['totalRows_p'])) {
$totalRows_p = $_GET['totalRows_p'];
} else {
if($debugP)
echo "<hr>Property with out limit SQL: $sql $sort";
$all_p = mysql_query($sql.$sort);
$totalRows_p = mysql_num_rows($all_p);
if($debugP)
echo "<br>Result Rows $totalRows_p";
}
$totalPages_p = ceil($totalRows_p/$maxRows_p)-1;
if($debugP)
echo "<hr>Builting Query String for Limit: ";
###Build query string
foreach($_GET as $name => $value){
if($name != "pageNum_p")
$queryString_p .= "&$name=$value";
}
if($debugP)
echo $queryString_p;
?>
<div align="left" class="locText">Home<span class="locArrow"> > </span> Search Results</div>
<hr size="1" color="#666666">
<table border="0" align="center">
<tr>
<td align="center">
<?php if ($pageNum_p > 0) { ### Show if not first page ?>
< href="<?php printf("%s?pageNum_p=%d%s", $currentPage, 0, $queryString_p); ?>" class="pageLink">First</a> |
<?php } ### Show if not first page ?>
<?php if ($pageNum_p > 0) { ### Show if not first page ?>
< href="<?php printf("%s?pageNum_p=%d%s", $currentPage, max(0, $pageNum_p - 1), $queryString_p); ?>" class="pageLink">Previous</a> |
<?php } ### Show if not first page ?>
<?php if ($pageNum_p < $totalPages_p) { ### Show if not last page ?>
< href="<?php printf("%s?pageNum_p=%d%s", $currentPage, min($totalPages_p, $pageNum_p + 1), $queryString_p); ?>" class="pageLink">Next</a> |
<?php } ### Show if not last page ?>
<?php if ($pageNum_p < $totalPages_p) { ### Show if not last page ?>
< href="<?php printf("%s?pageNum_p=%d%s", $currentPage, $totalPages_p, $queryString_p); ?>" class="pageLink">Last</a>
<?php } ### Show if not last page ?>
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="pageText" >Showing: <strong><?php echo ($startRow_p + 1) ?> to <?php echo min($startRow_p + $maxRows_p, $totalRows_p) ?> of <?php echo $totalRows_p ?></strong> Listings</td>
<td align="right" class="pageText"></td>
</tr>
</table></td>
</tr>
<tr>
<td height="5">xx</td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="1" cellpadding="4" class="resBorder">
<tr>
<td class="colText">Address</td>
<td class="colText">City</td>
<td class="colText">ST</td>
<td class="colText">Price</td>
<td class="colText">Beds</td>
<td class="colText">Baths</td>
<td class="colText">Sqft</td>
</tr>
<?php while($row_p = #mysql_fetch_assoc($searchResults)) { ?>
<tr valign="top">
<td class="bodytext"><?php echo $row_p['address']; ?></td>
<td class="bodytext"><?php echo $row_p['city']; ?></td>
<td class="bodytext"><?php echo $row_p['district']; ?></td>
<td class="bodytext"><?php echo Money($row_p['price'],1); ?></td>
<td class="bodytext"><?php echo $row_p['rooms']; ?></td>
<td class="bodytext"> </td>
<td class="bodytext"><?php echo $row_p['floor']; ?></td>
</tr>
</table></td>
</tr>
<? } ?>
</table></td>
</tr>
<tr>
<td height="5">xx</td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="pageText"> </td>
<td align="right"></td>
</tr>
</table></td>
</tr>
</table>
<p> </p>
<?
## if no results where found
if(#mysql_num_rows($searchResults)<=0){
foreach($error as $name => $value)
print '<div align=center class="error">'.$name . ': ' . $value.'</div>';
}
##Fetch Footer
?>
<script>
document.getElementById('loading').style.display = 'none';
</script>
Try changing:
###Perform search
$searchResults = mysql_query($sql.$sql_with_limit);
To:
###Perform search
$searchResults = mysql_query($sql_with_limit);

Categories