Property website - php paging

Hi.

I have a property website and when I do a search, the properties should come up fine, but the server cant handle such a long download time. I only want 2 properties to show and then have a link to show the next 2.

I have attached my code.

If anyone can help, that would be fantastic as I seem to be at a dead-end


<?php require_once('Connections/oak_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="header">
        <h1><a href="http://www.oaklanecountryestates.co.za" title="Link to the home page">Oaklane Country Estates<span></span></a></h1>   
      </div>
    <div id="nav">
    </div>
    <div id="consume">
        <div id="map_area">
        </div>
      <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', '***', '****', '*****');
                if (mysqli_connect_errno()) {
                    echo 'Error : Could not connect to database. Please try again later.';
                    exit;
                }
                
                
                $query = "select * from property_profile where property_profile.area='".mysql_real_escape_string($area)."' and (property_profile.price between '".mysql_real_escape_string($price_from)."' and '".mysql_real_escape_string($price_to)."')" or die(mysql_error());
                $result = $db->query($query);
                
                $num_results = $result->num_rows;
                
                echo "<h2>Results matching your query : ".$num_results."</h2>";

                for ($i=0; $i<=$num_results; $i++) {
                    $row_getProp = $result->fetch_assoc();
                ?>
              <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>&nbsp;&nbsp;<?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
                    }
                    $result->free();
                    $db->close();
                ?>    
      </div>
    </div>
    <div id="footer">
    </div>
</div>
</body>
</html>
<?php
mysql_free_result($getProp);
?>

try this

http://articles.sitepoint.com/article/perfect-php-pagination

vineet

thanks. ill give it a go.

Cheers
Donovan

Hi. I looked at the link that was provided. Unfortunately, I am new to php.
There is a statement that says the following :

//create an array of names in alphabetic order. A database call could have retrieved these items
$names = array(“Andrew”, “Bernard”, “Castello”, “Dennis”, “Ernie”, “Frank”, “Greg”, “Henry”, “Isac”, “Jax”, “Kester”, “Leonard”, “Matthew”, “Nigel”, “Oscar”);

How would I get a database to retrieve items for my array.

Cheers
Donovan