smartguyin Posted July 28, 2006 Share Posted July 28, 2006 As the query gives lots of results i want to get the page numbers on the screen soo that limiteed number of results can be displayed and others on other pages... systematicallyI have built one code I know some thing is wrong in this either the code is not properly arranged or the function paginate() not working properly... Below is the code i prepared... Please Correct Me.... Where am i going wrong..[code]<?phpsession_start();include "conn.inc.php";include "header.php";/////////////if (isset ($_POST['submit']) && $_POST['submit'] == "Search") {$currpage = $_SERVER['PHP_SELF'];global $limit;if(isset($_GET['page'])) {$page = $_GET['page'];} else {$page = 1;}if ($limit == "") $limit = 5;$start = ($page - 1)*$limit;function paginate($limit=10) {global $admin;$sql = "SELECT FOUND_ROWS();";$result = mysql_query($sql)or die(mysql_error());$row = mysql_fetch_array($result);$numrows = $row[0];$pagelinks = "<div class=\"pagelinks\">";if($numrows > $limit) {if(isset($_GET['page'])) {$page = $_GET['page'];} else {$page = 1;}} else {$pagelinks .= "<span class='pageprevdead'><PREV</span> ";$pagelinks .= "<span class='pageprevdead'><PREV</span> ";}}if($page == 1) {$pagelinks .= "<span class='pageprevdead'>< PREV</span>";} else {$pageprev = $page - 1;$pagelinks .= "<a class=\"pageprevlink\" href'".$currpage."&page=".$pageprev."'>< PREV</a>";}global $pagelinks;$query = "SELECT SQL_CALC_FOUND_ROWS * FROM fl WHERE fl_city = '".$_POST['place']."' AND fl_sellbuy = '1' ORDER BY fl_date DESC LIMIT $start,$limit";$results = mysql_query($query)or die(mysql_error());$pagelinks = paginate($limit);echo "<center><h2>Search results for Property Type Flat or Gala</h2></center><p></p>";while ($row = mysql_fetch_assoc($results)) {echo "<table border=\"0\" class='data'>\n";echo "<tr valign='top'>\n";echo "<td width='190'><p><b>Property Type</b>:- ".$row['fl_flatgala']."<br> <b>Property posted by</b> ".$row['fl_userid']."<br><br> <font size='1'><b>Date/Time of Post</b>:- ".$row['fl_date']."</font></p> <i><p><font size='2'><a href='flatgaladetails.php?id=".$row['fl_id']."'>Click here for more property details</a></font></p></i></td> <td width='203'> <p><b>Property ID</b>:-".$row['fl_id']."<br><b>Property Title</b> :- ".$row['fl_title']."</p> <p><b>Description</b>:- ".$row['fl_desc']."</p> </td> <td width='182'> <p><b>Area</b>:- ".$row['fl_area']."</p> <p><b>Price</b>:- ".$row['fl_price']."</p> <p><b>Property Address</b>:-<br> ".$row['fl_address']."</p> </td> <td width='128'><b><i><a href='contact.php?id=".$row['fl_id']."&type=buy flat/gala'>Click here to contact for buying this propety</a><b></i></td>";echo "</tr>\n";echo "</table><hr>\n";}////echo $pagelinks;include "footer.php";?>[/code]Please Help Me this ..... I am very new to this paging thing.... Please Help Me..... Link to comment https://forums.phpfreaks.com/topic/15902-help-me-with-paginate-page-number/ Share on other sites More sharing options...
smartguyin Posted July 29, 2006 Author Share Posted July 29, 2006 PLEASE HELP ME !!! Link to comment https://forums.phpfreaks.com/topic/15902-help-me-with-paginate-page-number/#findComment-65539 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.