truepal20032001 Posted January 22, 2007 Share Posted January 22, 2007 Hello, i am very interested in php, and had started creating my first codes, but i have a simple question i want to apply to my website....something like this...[img]http://www.coronadosoccer.com/my_docs/help.jpg[/img]the website i am talking about is [url=http://www.coronadosoccer.com/home]www.coronadosoccer.com/home[/url]thanks in advance Quote Link to comment Share on other sites More sharing options...
linuxdream Posted January 22, 2007 Share Posted January 22, 2007 I think what you want to look into is called pagination. Though pagination usually occurs when you either have too many results of a search to display on one page or you are progressing a user through a site in a very systematic way. You should post your site URL and explain what type of pagination you need. Quote Link to comment Share on other sites More sharing options...
truepal20032001 Posted January 22, 2007 Author Share Posted January 22, 2007 i actually posted it, at the very bottom of my post, and if you say so about pagination, i am just thinking ahead, there are going to be many updates soon and i want to be ready...thanks Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 22, 2007 Share Posted January 22, 2007 There is a good tutorial on pagination on this site. Quote Link to comment Share on other sites More sharing options...
truepal20032001 Posted January 22, 2007 Author Share Posted January 22, 2007 can you give me a link to a really good newb tutorial, thanks! :) Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 22, 2007 Share Posted January 22, 2007 http://www.phpfreaks.com/tutorial_cat/25/Page-Number--Pagination.php Quote Link to comment Share on other sites More sharing options...
truepal20032001 Posted January 22, 2007 Author Share Posted January 22, 2007 thankyou very much! Quote Link to comment Share on other sites More sharing options...
Ninjakreborn Posted January 22, 2007 Share Posted January 22, 2007 [code] <?phpif ($_GET['rownumberprev']) { $rownumber = mysql_real_escape_string($_GET['rownumberprev']);}elseif ($_GET['rownumbernext']) { $rownumber = mysql_real_escape_string($_GET['rownumbernext']);}else { $rownumber = 0;}$limit = 20;// get total amount of rows in database$year = date("Y");$month = date("n");$selecttemp = "SELECT * FROM specialimagesystem;";$querytemp = mysql_query($selecttemp);$total_rows = mysql_num_rows($querytemp); // get current year and date, for use with query $select1 = "SELECT * FROM specialimagesystem LIMIT $rownumber, $limit;"; $query1 = mysql_query($select1); while ($row1 = mysql_fetch_array($query1)) { echo "<div class=\"specialimagesystem\">\n"; $target = "/specialimages/"; $width = "100px"; $height = "100px"; echo "<a href=\"{$target}{$row1[name]}\" class=\"thickbox\" title=\"{$row1[description]}\" rel=\"gallery1\"><img src=\"{$target}{$row1[name]}\" width=\"{$width}\" height=\"{$height}\" alt=\"{$row1[name]}\" /></a>"; echo "<span style=\"float:left;\">"; // starts span for price and id echo $row1['description']; echo "<br />"; if ($row1['price'] != "") { // if price is set, then show it echo "Price: $" . $row1['price']; echo "<br />"; }// either way show the id echo "ID: " . $row1['id']; echo "</span>"; echo "<br /></div>\n"; } ?> </div><div class="pag"><?php// pagination script part down hereif ($rownumber != 0) { $rownumberprev = $rownumber - $limit; echo "<a href=\"totalinventorypictures.php?rownumberprev={$rownumberprev}\">Previous Page</a>"; echo "<br />";}if ($rownumber <= ($total_rows - $limit)) { $rownumbernext = $rownumber + $limit; echo "<a href=\"totalinventorypictures.php?rownumbernext={$rownumbernext}\">Next Page</a>"; }?></div>[/code]Just a quick example of how I normally do pagination, to give you something to look out too. Quote Link to comment 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.