uwannadonkey Posted August 14, 2007 Share Posted August 14, 2007 ??? i found this code on one of the topics i think its guilty's <?php include('inc/header.php'); $con = mysql_connect("localhost","donkey9_Admin","***"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("donkey9_Game", $con); $page_num = $_GET['page']; if(empty($page_num)) { $page_num = 1; } $ppp = 5; //posts per page $min_ppp = ($ppp*$page_num)-$ppp; $query = mysql_query("SELECT * FROM users") or die(mysql_error()); $num_rows = mysql_num_rows($query); $query = mysql_query("SELECT * FROM users ORDER BY level LIMIT $min_ppp, $ppp") or die(mysql_error()); $rows = mysql_num_rows($query); $pages = ceil($num_rows/$ppp); while($row = mysql_fetch_array($query)) { $first_name = $row['ID']; $last_name = $row['display_name']; $points = $row['level']; $tutor = $row['gold']; echo "<table><tr><td>$first_name $last_name</td><td>$tutor</td>/<td>$points<td/></tr></table>"; } if($page_num == 1) { echo "Prev "; } else { $prev_page = $page_num-1; echo "<a href=\"{$PHP_SELF}?page={$prev_page}\">Prev</a>"; } for($i = 1; $i <= $pages; $i++) { if($i == 1) { echo " "; } if($i == $page_num) { echo $i; } else { echo "<a href=\"{$PHP_SELF}?page={$i}\">{$i}</a>"; } if($i != $pages) { echo ", "; } else { echo " "; } } if($page_num == $pages) { echo "Next"; } else { $next_page = $page_num+1; echo "<a href=\"{$PHP_SELF}?page={$next_page}\">Next</a>"; } mysql_close($con) ?> well i was editing it, i wanna turn it into a ranking page for my game, but when i try to do that, this happens: / 4 dime 0 1 / 5 tommy 0 1 / 6 The Prophet 71 1 / 7 D4rksorrow 500 1 / 12 Dracor 338 1 where do the slashes come from? and how do i make them all lined up in a table? i tried to do it, but its not working? Quote Link to comment https://forums.phpfreaks.com/topic/64919-solved-problem-with-pagination/ Share on other sites More sharing options...
chronister Posted August 14, 2007 Share Posted August 14, 2007 while($row = mysql_fetch_array($query)) { $first_name = $row['ID']; $last_name = $row['display_name']; $points = $row['level']; $tutor = $row['gold']; echo "<table><tr><td>$first_name $last_name</td><td>$tutor</td>/<td>$points<td/></tr></table>"; } The key is right here in this block of code. Notice, your in a while loop, so your creating whole new tables for this text, the slash comes from between $tutor</td> / <td>$points Try this. <table> <?php while($row = mysql_fetch_array($query)) { $first_name = $row['ID']; $last_name = $row['display_name']; $points = $row['level']; $tutor = $row['gold']; echo "<tr><td>$first_name $last_name</td><td>$tutor</td><td>$points<td/></tr>"; } ?> </table> Quote Link to comment https://forums.phpfreaks.com/topic/64919-solved-problem-with-pagination/#findComment-323931 Share on other sites More sharing options...
uwannadonkey Posted August 14, 2007 Author Share Posted August 14, 2007 thx, i couldnt see anything in that mess, i was staring at it for like 5 min lol how about the table? they arent lining up nicely Quote Link to comment https://forums.phpfreaks.com/topic/64919-solved-problem-with-pagination/#findComment-323936 Share on other sites More sharing options...
GingerRobot Posted August 14, 2007 Share Posted August 14, 2007 What does "not lining up nicely" mean? It would help most if you could show us the output. Quote Link to comment https://forums.phpfreaks.com/topic/64919-solved-problem-with-pagination/#findComment-323947 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.