I modified your code according to your need. Use it. Move getPaging function to functions.php. Replace result_page.php with your current php file which you using for displaying results.
Cheers :)
<?php require_once("includes/connection.php"); ?>
<?php require_once("includes/functions.php"); ?>
<?php include("includes/header.php"); ?>
function getPaging($page_name,$table,$limit,&$eu)
{
ob_start();
if (isset($_REQUEST['start'])){
$start=$_REQUEST['start'];
}else{
$start = 0;
} // To take care global
variable if OFF
/*if(!($start > 0)) { // This variable is set to zero for the first
page
$start = 0;
}*/
$eu = ($start - 0);
// No of records to be shown per page.
$this1 = $eu + $limit;
$back = $eu - $limit;
$next = $eu + $limit;
$query2=" $table ";
$result2=mysql_query($query2);
echo mysql_error();
$nume=mysql_num_rows($result2);
$query="$table limit $eu, $limit ";
$result=mysql_query($query) or die(mysql_error().$query);
if($nume > $limit ){
?>
<table align = 'center' ><tr><td align='left' >
<?php
if($back >=0) {
?>
<a href='<?php echo("$page_name&start=$back");?>'>PREV</a>
<?php
}
?>
</td><td align=center>
<?php
$i=0;
$l=1;
for($i=0;$i < $nume;$i=$i+$limit){
if($i <> $eu){
?>
<a href='<?php echo("$page_name&start=$i");?>'><?php echo("$l");?></a>
<?php
}
else { echo "<strong> $l </strong>";} /// Current page is not displayed as link and
given font color red
$l=$l+1;
}
?>
</td><td align='right' >
<?php
if($this1 < $nume) {
?>
<a href='<?php echo("$page_name&start=$next");?>'>NEXT</a>
<?php
}
?>
</td></tr></table>
<?php
}
$str= ob_get_contents();
ob_end_clean();
return $str;
}
<td id="page">
<h2>Welcome to Coordination Real Estate</h2>
<script type="text/javascript" src="javascript/container_core-min.js"></script>
<script type="text/javascript" src="javascript/carousel.js"></script>
<link rel="stylesheet" type="text/css" href="stylesheets/base-min.css">
<link href="stylesheets/carousel.css" rel="stylesheet" type="text/css">
<link href="stylesheets/yui.css" rel="stylesheet" type="text/css">
<?php
if(count($_POST)>0){
$listedPrice = $_POST['listedPrice'];
$No_bedroom = $_POST['No_bedroom'];
$PropertyCountry = $_POST['country'];
$PropertyCity = $_POST['cityList'];
$PropertyType = $_POST['PropertyType'];
$NO_bathroom = $_POST['NO_bathroom'];
$listtemp = explode("-", $listedPrice,2);
$start=0;
$end=0;
$qry="SELECT * from properties WHERE
listedPrice between {$listtemp[0]} AND {$listtemp[1]} AND
No_bedroom = $No_bedroom AND
PropertyCountry = '$PropertyCountry' AND
PropertyCity = '$PropertyCity' AND
PropertyType = $PropertyType AND
NO_bathroom = $NO_bathroom";
$orderby="";
$pagingdata=getPaging("result_page.php?",$qry ,10,$start);
$sql="$qry $orderby limit $start,10";
}else{
$query = "SELECT * from properties;";
}// end if
//run query and check for errors
$query2 = mysql_query($sql);
if(!$query2) die('SQL error: '.mysql_error());
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<?php
while ($row = mysql_fetch_row($query2)){
//var_export($row);
?>
<tr class="box01">
<td width="28%" height="136" align="center" valign="middle"> <?php echo '<img width="159" height="113" src="uploaded_Images/';
echo $row['3'] . '" alt="' . $row['3'];
echo '"/></a>'; ?> </td>
<td width="72%" align="left" valign="top"> <table width="80%" border="0" cellspacing="5" cellpadding="0">
<tr>
<td class="protext">Name </td>
<td class="protext01">
<?=$row[1]?>
</td>
</tr>
<tr>
<td width="31%" class="protext">Type </td>
<td width="69%" class="protext01">
<?=$row[2]?>
</td>
</tr>
<tr>
<td width="31%" class="protext">Property Address</td>
<td width="69%" class="protext01">
<?=$row[4]?>
</td>
</tr>
<td width="31%" class="protext">Sub Type </td>
<td width="69%" class="protext01">2 BR</td>
</tr>
<td width="31%" class="protext">Sub Type </td>
<td width="69%" class="protext01">2 BR</td>
</tr>
<td width="31%" class="protext">Sub Type </td>
<td width="69%" class="protext01">2 BR</td>
</tr>
<td width="31%" class="protext">Sub Type </td>
<td width="69%" class="protext01">2 BR</td>
</tr>
<td width="31%" class="protext">Sub Type </td>
<td width="69%" class="protext01">2 BR</td>
</tr>
</table></td>
</tr>
<?php
}
?>
<tr class="box01">
<td height="24" align="center" valign="middle"> </td>
<td align="left" valign="top"><?php echo $pagingdata; ?></td>
</tr>
</table>
<br /><br />
</td>
</tr>
<br /><br />
</table>
<br /><br />
<?php require("includes/footer.php"); ?>
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193:





by: al3cs12Posted on 2009-03-08 at 03:16:36ID: 23828671
Read this tutorial and you'll understand how pagination works: http://www.phpfreaks.com/t utorial/ba sic-pagina tion/page1
Cheers