legohead6 Posted December 23, 2006 Share Posted December 23, 2006 EDIT: I closed one of the brackets at the worng spot! problem SOLVED[code]<?PHPsession_start();$user=$_SESSION['user'];include 'header.php';$username="**********";$password="**********";$database="**********";$connect = mysql_connect(localhost,$username,$password);@mysql_select_db($database) or die( "Unable to select database");if(empty($_GET['catagory'])){echo "<h1 align=center>Catagorys</h1>";$cata1="SELECT * FROM listingcat ORDER BY catagory ASC";$catar= mysql_query($cata1);echo "<p align=center><a href=browse.php?catagory=all>All Catagorys</a>";while($cata = mysql_fetch_row($catar)){$counting = "SELECT COUNT(*) FROM listings WHERE cat='$cata[1]' AND sold='0' ORDER BY id ASC";$resultm = mysql_query($counting);$rowm = mysql_fetch_array($resultm, MYSQL_NUM);$numbs = $rowm[0];$catc=str_replace("_"," ", $cata[1]);echo "<p align=center><a href=browse.php?catagory=$cata[1]>$catc</a>($numbs)";}echo "<br><br><br>";include 'footer.php';exit();}else{echo "<div align=center><a href=browse.php>Return to List of Catagorys</a><br><br>";$display=10;if(isset($_GET['s'])){$start=$_GET['s'];}else{$start=0;}$pvs=$_GET['pvs'];$ncat=$_GET['catagory'];if($ncat == 'all'){$counting = "SELECT * FROM listings WHERE sold='0' ORDER BY id ASC";$showing = "SELECT * FROM listings WHERE sold='0' LIMIT $start, $display";}else{if(isset($_POST['submit']) OR $pvs != ''){if(!empty($pvs)){$search=$pvs;}else{$search=$_POST['search'];}$ncat=$_GET['catagory'];echo "<h1>$ncat</h1>";$counting = "SELECT * FROM listings WHERE cat='$ncat' AND (title LIKE '%$search%' OR description LIKE '%$search%') AND sold='0' ORDER BY id ASC";$showing = "SELECT * FROM listings WHERE cat='$ncat' AND (title LIKE '%$search%' OR description LIKE '%$search%') AND sold='0' LIMIT $start, $display";}else{$ncat=$_GET['catagory'];echo "<h1>$ncat</h1>";$counting = "SELECT * FROM listings WHERE cat='$ncat' AND sold='0' ORDER BY id ASC";$showing = "SELECT * FROM listings WHERE cat='$ncat' AND sold='0' LIMIT $start, $display";}}}$page = "$counting";$resultp = mysql_query($page);$num_records = mysql_num_rows($resultp);if($num_records == '0'){echo "<p align=center>There are No Listings</p>";}else{echo "<p align=center>There are $num_records Listings</p>";}if(isset($_GET['no problem'])){$num_pages = $_GET['no problem'];}else{$page = "$counting";$resultp = mysql_query($page);$num_records = mysql_num_rows($resultp);if($num_records > $display){$num_pages = ceil($num_records/$display);}else{$num_pages = 1;}$query2="$showing";echo "<table border=1>";$result2 = mysql_query($query2) or die ("Error in query: $query2. ".mysql_error());$num = mysql_num_rows ($result2);while($row = mysql_fetch_row($result2)){$member1="SELECT * FROM members WHERE username='$row[5]'";$resultm = mysql_query($member1) or die ("Error in query: $member. ".mysql_error());while($mem = mysql_fetch_row($resultm)){$title = str_replace(' ', '_', $row[1]);echo "<tr><td width=300><p align=center><a href=listing.php?id=$row[0]&catagory=$ncat&pvs=$search&c=$catagory>$title</a><br><font size=2>Location: $mem[10]</td><td width=100>Price: $$row[2]</p></td></tr>";}}?><form method="POST"> <p>Search:<input type="text" name="search" size="30"> <input type="submit" value="Search" name="submit"></p><?PHPecho "</form>";if ($num_pages > 1){echo '<br><p>';$current_page = ($start/$display) + 1;if($current_page != 1){echo '<a href="browse.php?s'.($start - $display).'$no problem='.$num_pages.'&catagory='.$ncat.'">Previous</a> ';}for($i =1; $i <= $num_pages; $i++){if ($i != $current_page){echo '<a href="browse.php?s='.(($display*($i - 1))).'&no problem='.$num_pages.'&catagory='.$ncat.'">' . $i . '</a> ';}else{echo $i.'';}}if($current_page != $num_pages){echo '<a href="browse.php?s='.($start + $display).'&no problem='.$num_pages . '&catagory='.$ncat.'">Next</a> ';}}mysql_close($connect);?><html><body><div align=center></div><!-- Begin PayPal Logo --><A HREF="https://www.paypal.com/row/mrb/pal=N46WFHASFN2R8" target="_blank"><IMG SRC="http://images.paypal.com/en_US/i/bnr/paypal_mrb_banner.gif" BORDER="0" ALT="Sign up for PayPal and start accepting credit card payments instantly."></A><!-- End PayPal Logo --></body></html><?echo "<p><br><br><br>";include 'footer.php';echo "</p>";}?>[/code] Link to comment https://forums.phpfreaks.com/topic/31721-solved-paginating-isnt-working/ Share on other sites More sharing options...
Jessica Posted December 23, 2006 Share Posted December 23, 2006 Please indent your code! I can barely read this. :(Can you link to the actual page so I can see EXACTLY what is printing out? Link to comment https://forums.phpfreaks.com/topic/31721-solved-paginating-isnt-working/#findComment-147024 Share on other sites More sharing options...
legohead6 Posted December 23, 2006 Author Share Posted December 23, 2006 I guess i need to work on making my code readable...lol Link to comment https://forums.phpfreaks.com/topic/31721-solved-paginating-isnt-working/#findComment-147030 Share on other sites More sharing options...
Jessica Posted December 23, 2006 Share Posted December 23, 2006 Edit: Posted in the wrong thread! Link to comment https://forums.phpfreaks.com/topic/31721-solved-paginating-isnt-working/#findComment-147032 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.