ok. I have tried to implement the code, but still cant seem to get it right.
Please can you have a look at my updated code.
Code: Select all
<?php require_once('Connections/propProfile.php'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Search results</title>
</head>
<body>
<div id="wrapper">
<p class="accessaid"><a href="#consume" title="Skip past the navagation, to the content">Skip to page content</a></p>
<div id="consume">
<div id="house">
<h2>Search results</h2>
<?php
// Create short variable names
$area = $_POST['area'];
$price_from = str_replace(" ","",$_POST['price_from']);
$price_to = str_replace(" ","",$_POST['price_to']);
@ $db = new mysqli('localhost', 'root', '****', '*****');
if (mysqli_connect_errno()) {
echo 'Error : Could not connect to database. Please try again later.';
exit;
}
// Display the page links
$page = 1;
$prev_page = $page - 1;
$next_page = $page +1;
$num_pages = CEIL($num_rows / 2);
$page_start = (2 * $page) - 2;
//put the limit in the query to get output for each page
$query="select * from property_profile where area='".mysql_real_escape_string($area)."' and (price between '".mysql_real_escape_string($price_from)."' and '".mysql_real_escape_string($price_to)."') $page_start, 2";
$result = mysql_query($query) or die("Couldn't execute query");
while ( $row_getProp = mysql_fetch_array($result) ) {
$query="select * from property_profile where area='".mysql_real_escape_string($area)."' and (price between '".mysql_real_escape_string($price_from)."' and '".mysql_real_escape_string($price_to)."') $page_start, 2";
$result = mysql_query($query) or die("Couldn't execute query");
// Start a table for the output.
?>
<div id="house">
<div class="profile">
<div id="contphp">
<div class="prop">
<div class="price">
<h3><span>R<?php echo number_format($row_getProp['price']); ?></span> <?php echo ($row_getProp['target_area']); ?></h3>
<p>Reference number : <?php echo $row_getProp['reference']; ?></p>
</div>
<div class="img_gal">
<?php
$parola = '';
$my_array = array("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v");
for ($i=0; $i<=10; $i++)
{
$random = array_rand($my_array);
//this generates the random number from the array
// echo "<br> count $i <br> $random call";
// echo the count number and the random number called from array_rand
if ($check[$random]<>0) {
$i--;
// echo "ed already try again";
// if check array isnt = 0 then the random number has been already called re random by taking 1 from $i to ensure correct number of results
} else {
$check[$random]=1;
// set check to 1 so it knows the array number has been used
$parola .= $my_array[$random];}
//here we will display the exact charachter from the array
}
// printing result
?>
<script type="text/javascript">
$(window).bind("load", function() {
$("div#mygalone<?php echo $parola; ?>").slideView()
});
</script>
<?php
$imagelist = $row_getProp[image];
$images = explode(',',$imagelist);
?>
<div id="mygalone<?php echo $parola; ?>" class="svw">
<ul>
<?php
for ($i=0;$i < count($images) ; $i++)
{
?>
<li><img alt="<?php echo $images[$i] ; ?>" src="upload/<?php echo $images[$i] ; ?>" width="230" height="180"/></li>
<?php
}
?>
</ul>
</div>
<script type="text/javascript">
$(window).bind("load", function() {
$("div#<?php echo $parola ; ?>").slideView({
easeFunc: "easeInOutBack",
easeTime: 2200
});
});
</script>
</div>
<div class="details">
<table>
<tr class="one">
<th>Bedrooms</th>
<td><?php echo $row_getProp['bedrooms']; ?></td>
<th>Bathrooms</th>
<td><?php echo $row_getProp['bathrooms']; ?></td>
</tr>
<tr>
<th>Garages</th>
<td><?php echo $row_getProp['garages']; ?></td>
<th>Pool</th>
<td><?php echo $row_getProp['pool']; ?></td>
</tr>
<tr class="one">
<th>Fencing</th>
<td><?php echo $row_getProp['fencing']; ?></td>
<th>Security</th>
<td><?php
if (!(strcmp($row_getProp['security'],"security"))) {
echo "yes";
} else {
echo "No";
}
?> </td>
</tr>
<tr>
<th>
Outbuildings
</th>
<td>
<?php echo $row_getProp['fencing']; ?>
</td>
<th>
Land use
</th>
<td>
<?php echo $row_getProp['land_use']; ?>
</td>
</tr>
<tr>
<th>
Size of farm
</th>
<td>
<?php echo $row_getProp['size']; ?>
</td>
<th>
Water
</th>
<td>
<?php echo $row_getProp['water']; ?>
</td>
</tr>
</table>
</div>
<div class="desc">
<h3>Description :</h3>
<p><?php echo $row_getProp['description']; ?></p>
</div>
</div>
</div>
</div>
</div>
<?php
echo "<div class = pages> <br><br>";
// Set up the page links and pass any needed variables to the next page by including them in the href after the page variable.
if (!$prev_page < "1") {
echo"<a href='pagename.php?page=$prev_page&num_pages=$num_pages'><font color='#400000'>< Previous page.</font></a>";
}
if ($page != $num_pages) {
echo "<a href='pagename.php?page=$next_page&num_pages=$num_pages'><font color='#400000'> Next page.></font></a></CENTER>";
}
}
$result->free();
$db->close();
?>
</div>
</div>
</div>
</body>
</html>
<?php
mysql_free_result($getProp);
?>
I know im probably being a pain in the butt, cause its probably so easy for an experienced coder. For that I am sorry.
Cheers
Donovan