I have the code to do the search. But the search results are not in the same table. All search results appear in a different table. How do I make them appear in one table?
screenshots :
<?php if(isset($_POST['submit']))
{
if(empty($_POST['word'])){
echo "<center>Title do not match. Please insert the correct title.</center>";}
else {
if(isset($_POST['word'])&& !empty($_POST['word']))
{
require 'config.php';
$word = $_POST['word'];
$query="SELECT * FROM data WHERE word LIKE '%" . $word . "%'";
$sql = $conn->query($query); ?>
<?php if(!$sql)
{
echo "<center>No Record</center>";
}
?>
<table align="center" border="0" >
<tr>
<td width="900">
<?php while($row = $sql->fetch_assoc()){
$dataID = $row['dataID'];
?>
<?php if($sql ==true){?>
<table class="table table-bordered table-hover table-striped">
<tr>
<td width="258" align="center" class="style5">TITLE</td>
<td width="170" align="center" class="style5">MENTION</td>
</tr>
<tr>
<td style="text-transform:uppercase" align="center"> <span style="text-transform:uppercase"><?php echo $row{'word'};?></span> </td>
<td style="text-transform:uppercase" align="center"><span style="text-transform:uppercase"><?php echo $row{'mention'};?></span></td>
</tr>
<?php }}} ?>re
Where do we start?
1.) Try avoiding styling in your html. It isn't forbidden, but your global style is better of when used with CSS.
http://www.w3schools.com/css/
For exampe: Imagine this rule:
<td style="text-transform:uppercase" align="center"> <span style="text-transform:uppercase"><?php echo $row{'word']; ?></span> </td>
that could also be:
<td>
<a href="admindisplay.php?id=<?php echo $row['dataID']; ?>">
<?php echo $row['word'];?>
</a>
</td>
2.) Try indenting. Use an IDE (Notepad with some extra highlighting features and nice indenting. By structuring and neatly placing the brackets "[] {} and ()" you make code more readable and make it easier to DEBUG your own code.
3.) When using SQL, your input should ALWAYS be escaped. Maybe I'm wrong and you have a DB class that does this for you. Although, you should ALWAYS be aware of this: This could prevent SQL Injection and might one day safe your life (or your job).
Escaping: Making your query safe and let it do only thing you want it to do.
SQL INJECTION: Adding malicous characters and code to INPUT so your QUERY does other things than you want.
4.) Try structering what you are doing or the goal you're trying to reach.
<?php
Class DoSearch()
{
protected $search_string;
public function __construct()
{
if(!$this->verify())
return $this->__html('<center>Title do not match. Please insert the correct title.</center>');
$this->search()
}
public function verify()
{
if(isset($_POST['word']))
return false;
if(empty($_POST['word']))
return false;
global $conn;
$this->search_string = $conn->escape($_POST['word']);
return true;
}
public function search()
{
global $conn;
$query = "SELECT * FROM data WHERE word LIKE '%" . $this->search_string . "%'";
$sql = $conn->query($query);
if(!$sql)
return $this->__html('<center>No Record</center>');
$table = array();
$i = 0;
$tableHtml = '
<table class="table table-bordered table-hover table-striped">
<tr>
<th width="258" align="center" class="style5">TITLE</th>
<th width="170" align="center" class="style5">MENTION</th>
</tr>';
while($row = $sql->fetch_assoc())
{
$tableHtml .= '
<tr>
<td style="text-transform:uppercase" align="center"> <span style="text-transform:uppercase">'.$row['word'].'</span> </td>
<td style="text-transform:uppercase" align="center"><span style="text-transform:uppercase">'. $row['mention'].'</span></td>
</tr>
';
}
$tableHtml .= '
</table>
';
return $this->__html($tableHtml);
}
public function __html($msg)
{
echo $msg;
}
}
require_once 'config.php';
$search = new DoSearch();
Move your table code outside of your loop, and only create a new row each time you loop. You were creating a new table each time you loop.
<table class="table table-bordered table-hover table-striped">
<tr>
<td width="258" align="center" class="style5">TITLE</td>
<td width="170" align="center" class="style5">MENTION</td>
</tr>
<?php while($row = $sql->fetch_assoc()){
$dataID = $row['dataID'];
?>
<?php if($sql ==true){?>
<tr>
<td style="text-transform:uppercase" align="center"> <span style="text-transform:uppercase"><?php echo $row{'word'};?></span> </td>
<td style="text-transform:uppercase" align="center"><span style="text-transform:uppercase"><?php echo $row{'mention'};?></span></td>
</tr>
<?php }}} ?>
Don't create a table each time a loop run. Make it simple.
Updated Code
<?php
if(isset($_POST['submit']))
{
if(empty($_POST['word'])) {
echo "<center>Title do not match. Please insert the correct title.</center>";}
else
{
if(isset($_POST['word']) && !empty($_POST['word']))
{
require 'config.php';
$word = $_POST['word'];
$query="SELECT * FROM data WHERE word LIKE '%" . $word . "%'";
$sql = $conn->query($query); ?>
<?php if(!$sql)
{
echo "<center>No Record</center>";
}
?>
<table class="table table-bordered table-hover table-striped">
<tr>
<td width="258" align="center" class="style5">TITLE</td>
<td width="170" align="center" class="style5">MENTION</td>
</tr>
<?php
if($sql ==true)
{
while($row = $sql->fetch_assoc())
{
$dataID = $row['dataID'];
?>
<tr>
<td style="text-transform:uppercase" align="center">
<a href="admindisplay.php?id=<?php echo $row{'dataID'}?>">
<span style="text-transform:uppercase"><?php echo $row{'word'};?></span>
</a>
</td>
<td style="text-transform:uppercase" align="center">
<span style="text-transform:uppercase"><?php echo $row{'mention'};?></span>
</td>
</tr>
<?}}
else
{?>
<tr>
<td colspan=2>Results Not Found.</td>
</tr>
<?}?>
</table>
<?php
}
}
}
?>
If the result is to be issued only in a (unformated) table, simply use this function:
function show_in_table($arr)
{
$count = count($arr);
$output = "";
if($count>0)
{
reset($arr);
$num = count(current($arr));
$output.= '<table cellpadding="0" cellspacing="0">'."\n";
$output.="<tr>\n";
foreach(current($arr) as $key => $value)
{
$output.="<th>";
$output.=$key." ";
$output.="</th>\n";
}
$output.="</tr>\n";
while ($curr_row = current($arr))
{
$output.="<tr>\n";
$col = 1;
while (false !== ($curr_field = current($curr_row)))
{
$output.="<td>";
$output.=$curr_field." ";
$output.="</td>\n";
next($curr_row);
$col++;
}
while($col <= $num)
{
$output.="<td> </td>\n";
$col++;
}
$output.="</tr>\n";
next($arr);
}
$output.="</table>\n";
}
return $output;
}
Related
<div class="table-responsive">
<table class="table table-hover" id="dataTable" width="100%" cellspacing="0" >
<thead>
<tr class=" card-header py-2" style=" text-align:center;">
<th> Er no</th>
<th> Name</th>
<th> Branch</th>
<th> Adm Year</th>
<th>Profile</th>
</tr>
<?php
if (isset($_POST['pass'])) {
$d = $_POST['spass'];
include('bcpdb.php');
$iq = "select * from stuinfo where ERNO like '%$d' ";
$qs = mysqli_query($con, $iq);
//echo "Serch Query Data";
if (!$qs) {
echo mysqli_error($con) . " DATA NOT INSERTED";
}
} else {
include('bcpdb.php');
$iq = "select * from stuinfo ";
$qs = mysqli_query($con, $iq);
//echo "select Query Data";
}
if (!$qs) {
echo mysqli_error($con) . " DATA NOT INSERTED";
}
while ($res = mysqli_fetch_assoc($qs)) {
?>
<tbody>
<tr>
<td> <?php echo $res['ERNO']; ?></td>
<td> <?php echo $res['SNAME']; ?></td>
<td><?php echo $res['BRANCH']; ?></td>
<td> <?php echo $res['ADMYEAR']; ?></td>
<td style="text-align:center;">
</td>
<?php
}
?>
</tr>
</tbody>
</table>
Just show rows in page not fetch all rows in datatable. I want all of the data of database fetch in datatable plugin, when I put some data in html table row column then it works perfectly, fetch and search all rows of data but in database data which fetch by select query, fetch only one row
[1]: https://i.stack.imgur.com/44FRd.jpg
I used prepared statements for my data collection. I am trying to display that data with a fetch_array function in an organized fashion. Is it possible to insert an html table into a php function that relies on a prepared statement?
I've read to use a HEREDOC, but I do not know what to do in place of the variables. I've also tried to create another document for a table, but have the same question.
This is the function I am using.
function showProfile($user) {
global $connection;
$query = "SELECT * FROM profiles WHERE user='$user'";
$result = $connection->query($query);
/* associative array */
$row = $result->fetch_array(MYSQLI_ASSOC);
printf(
"%s <br> %s\n",
$row["forename"],
$row["surname"]
) . "<br style='clear:left;'><br>";
}
This is the table I want to use
<table width="398" border="0" align="center" cellpadding="0">
<tr>
<td height="26" colspan="2">Your Profile Information </td>
</tr>
<tr>
<td width="82" valign="top"><div align="left">FirstName:</div></td>
<td width="165" valign="top"><?php echo $forename ?></td>
</tr>
<tr>
<td valign="top"><div align="left">LastName:</div></td>
<td valign="top"><?php echo $surname ?></td>
</tr>
</table>
I can display my data with the function, however, I want to display it in a more organized way.
instead of printf(), you can just echo
echo "<table width='398'> <-- check here the quote marks so the string doesnt break
<tr>
<td>".$row['forename']."</td> <- then concat all the variables you want like this
</tr>
</table>";
I have not tested but this function but it should work. I have wrapped the table rows, in a while loop, although it may not be necessary if you are getting back one row in your query.
function showProfile($user)
{
global $connection;
$query = $connection->prepare("SELECT * FROM profiles WHERE user = :user ");
$query->bindValue(':user', $user);
$result = $query->execute();
echo "<table width='398' border='0' align='center' cellpadding='0'>
<tr><td height='26' colspan='2'>Your Profile Information </td>
</tr> ";
/* associative array */
while($row = $result->fetch_array(MYSQLI_ASSOC))
{
echo "
<tr>
<td width='82' valign='top'><div align='left'>FirstName:</div></td>
<td width='165' valign='top'>{$row['forename']}</td>
</tr>
<tr>
<td valign='top'><div align='left'>LastName:</div></td>
<td valign='top'>{$row['surname']}</td>
</tr>";
}
echo "</table>";
}
As much as possible, you want to separate logic from presentation. Your table example is definitely on track. However, I would suggest thinking a little differently about the output of the function. Instead of the function returning HTML, have it return data that a view could use.
An object is much better suited for the task than a single function:
<?php
class Profile {
private $conn;
private $result;
public function __construct($conn) {
$this->conn = $conn;
}
public function findProfile($user) {
$query = “SELECT * FROM profiles WHERE user=?”;
$stmt = $this->conn->prepare($query);
$stmt->bind_param(‘s’, $user);
$stmt->execute();
$this->result = $stmt->get_result();
}
public function fetch() {
//if($row = $this->result->fetch_array(MYSQLI_ASSOC)) {
if($row = $this->result->fetch_assoc()) {
return $row;
}
return false;
}
}
Then your table can be separated into its own file, to be included whenever you wish (assuming $conn and $user are defined):
<?php
$p = new Profile($conn);
$p->findProfile($user);
?>
<!— html stuff here —>
<?php if($info = $p->fetch()): ?>
<table width="398" border="0" align="center" cellpadding="0">
<tr>
<td height="26" colspan="2">Your Profile Information </td>
</tr>
<tr>
<td width="82" valign="top"><div align="left">FirstName:</div></td>
<td width="165" valign="top"><?= $info[‘forename’] ?></td>
</tr>
<tr>
<td valign="top"><div align="left">LastName:</div></td>
<td valign="top"><?= $info[‘surname’] ?></td>
</tr>
</table>
<?php endif; ?>
I was trying to echo a variable before it was even defined so literally i'm getting this error "UNDEFINED VARIABLE: tpp"
<tr>
<td colspan='6'>
<h4><small>Trusted Players List <?php echo $tpp ?> Total)</small></h4>
</td>
</tr>
When i set that line down along with echo "" , it works. But i want it on the place where i set it [Top]
Here is the code which i need help with
<table class="table table-bordered">
<thead>
<tr>
<td colspan='6'>
<h4><small>Trusted Players List <?php echo $tpp ?> Total)</small></h4>
</td>
</tr>
<td>Number</td>
<td>Username</td>
<td>Last Login</td>
</thead>
<?php
$query = $koneksi->prepare("SELECT `user`, `TP`, `LastOnlineDate` FROM `playerdata` WHERE `banned`=0 AND `TP`=1");
$query->execute();
if($query->rowCount() == 0)
{
echo "<tr><td colspan='6'><small>No rows found</small></td></tr>";
}
$tpp = 0;
while($data = $query->fetch())
{
$tpp++;
echo "<tr><td>".$tpp."</td>";
echo "<td>".$data['user']."</td>";
echo "<td>".$data['LastOnlineDate']."</td></tr>";
}
?>
</table>
Any help will be so appreciated
thanks in advance.
$tpp is undefined because its being called before its been created, Try this out instead.
<?php
$tpp = 0;
$content = "";
$query = $koneksi->prepare("SELECT `user`, `TP`, `LastOnlineDate` FROM `playerdata` WHERE `banned`=0 AND `TP`=1");
$query->execute();
while($data = $query->fetch())
{
$tpp++;
$content .= "<tr><td>".$tpp."</td>";
$content .= "<td>".$data['user']."</td>";
$content .= "<td>".$data['LastOnlineDate']."</td></tr>";
}
?>
<table class="table table-bordered">
<thead>
<tr>
<td colspan='6'><h4><small>Trusted Players List <?php echo $tpp ?> Total)</small></h4></td>
</tr>
<td>Number</td>
<td>Username</td>
<td>Last Login</td>
</thead>
<?php
if($query->rowCount() == 0)
{
echo "<tr><td colspan='6'><small>No rows found</small></td></tr>";
}
echo $content;
?>
</table>
I've decided to run the loop at the top, placing all the data within $content and then echo $content where you wish to display the content. This allows you to still have your counter run and be displayed at the top of the table.
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());
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);