DarkPrince2005 Posted May 25, 2010 Share Posted May 25, 2010 Can anyone help me? I am generating pagination links but i need them to fit into a table cell with a width of 200px, so i need the pagination to continue over into multiple lines. <table style="width:200px;padding:0px;border:0px;border-spacing:0px;border-collapse:collapse"> <?php if(isset($_GET)){ if(mysql_num_rows(mysql_query($sql)) < 1){ echo 'empty'; } else { $count = 1; $recordCount = 20; $page = isset($_GET["page"]) ? $_GET["page"] : 1; $page = $page < 1 ? 1 : $page; $limitFrom = (($page-1) * $recordCount); $limitTo = ($limitFrom + $recordCount) - 1; //view all the news articles in rows $sqlr = mysql_query($sql." LIMIT $limitFrom, $recordCount") or die(mysql_error()); //the total rows in the table $totalres = mysql_num_rows(mysql_query($sql)); //the total number of pages (calculated result), math stuff... $totalpages = ceil($totalres / $recordCount); while($row = mysql_fetch_array($sqlr)) { echo '<tr><td class="nr"><span>'.$count++.'</span></td><td class="latest" valign="center"><a href="#">'.htmlentities($row["name"]).'<br /><span class="song">'.htmlentities($row["track_name"]).'</span></a></td><td class="latest"><img src="admin/uploads/'.htmlentities($row["inmg"]).'" height="35" /></td></tr>'; } echo '<tr><td colspan="3" style="text-align:justify;width:200px;max-width:200px;"><br />'; if ($page > 1){ echo "<a href=\"genres2.php?page=".($page-1)."\" style='padding:0 3px'>Previous</a>";} else { echo "Previous";} for($i = 1; $i <= $totalpages; $i++){ //this is the pagination link echo "<a href='genres2.php?page=$i&genre=".$_GET["genre"]."' style='padding:0 3px;display:inline;'>$i</a>|"; } if ($page < $totalpages){ echo "<a href=\"manage_tracks.php?page=".($page+1)."\" style='padding:0 3px'>Next</a>";} else { echo "Next";} echo '</td></tr>'; } } else{ } ?> </table> Link to comment https://forums.phpfreaks.com/topic/202874-multiline-pagination/ Share on other sites More sharing options...
DarkPrince2005 Posted May 25, 2010 Author Share Posted May 25, 2010 Ok never mind applied float left to the hyperlinks. but how can I prevent the count variable to not start at 1 on every page? Link to comment https://forums.phpfreaks.com/topic/202874-multiline-pagination/#findComment-1063187 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.