fbm Posted February 24, 2009 Share Posted February 24, 2009 Hi, First few days with PHP have gone ok with some small speed bumps along my way. I have some code which outputs a list of customer information, the code which generates this looks like this: <?php $result = mysql_query("SELECT * FROM clients ORDER BY client_name ASC"); while($row = mysql_fetch_array($result)) { echo "<tr style='padding:0px 0px 0px 10px';>\n"; echo "<td id='cl_row'><p>".$row['client_name']."</p></td>\n"; echo "<td id='cl_row'><p>".$row['client_email']."</p></td>\n"; echo "<td id='cl_row'><p>".$row['client_phone']."</p></td>\n"; echo "<td style='text-align:center;' height='35'><div id='button_view'><a alt='view' href='?page=process_view_client&id=".$row['client_id']."'><i>view</i></a></div><div id='button_edit'><a href='?page=process_edit_client&id=".$row['client_id']."'><i>edit</i></a></div><div id='button_delete'><a href='?page=process_delete_client&id=".$row['client_id']."'><i>delete</i></a></div></td>\n"; echo "</tr>\n"; } ?> Maybe a bit messy but im still learning It generates this <tr style='padding:0px 0px 0px 10px';> <td id='cl_row'><p>Mr Google</p></td> <td id='cl_row'><p>[email protected]</p></td> <td id='cl_row'><p>01232545444</p></td> <td style='text-align:center;' height='35'><div id='button_view'><a alt='view' href='?page=process_view_client&id=10'><i>view</i></a></div><div id='button_edit'><a href='?page=process_edit_client&id=10'><i>edit</i></a></div><div id='button_delete'><a href='?page=process_delete_client&id=10'><i>delete</i></a></div></td> </tr> And looks good in browsers so i'm happy with it so far. Any pointers on making my code cleaner would be appreciated but my main question is how to paginate my results. I want to display a maximum of 10 rows on a page and use pagination to view the rest of the rows. Any Advice? Cheers Link to comment https://forums.phpfreaks.com/topic/146779-how-to-implement-pagination/ Share on other sites More sharing options...
shadiadiph Posted February 24, 2009 Share Posted February 24, 2009 try this it worked for me http://www.phpfreaks.com/tutorial/basic-pagination Link to comment https://forums.phpfreaks.com/topic/146779-how-to-implement-pagination/#findComment-770611 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.