NoDoze Posted December 19, 2006 Share Posted December 19, 2006 For the life of me, I can't get it to work! Argh hehe...This is the original code:[code]<body bgcolor="#0554A3" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"><div class="text-header">Project Initiation Database</div><div class="prodatabase"><table class="table"><tr class="table-header"><td><a href="pil-view.php?sortby=id">ID</a></td><td><a href="pil-view.php?sortby=date">Initiation Date</a></td><td><a href="pil-view.php?sortby=project_number">Project Number</a></td><td><a href="pil-view.php?sortby=resposible_individual">Responsible Individual</a></td><td><a href="pil-view.php?sortby=project_description">Project Description</a></td><td><a href="pil-view.php?sortby=country">County</a></td><td><a href="pil-view.php?sortby=region">Region</a></td><td><a href="pil-view.php?sortby=client">Client</a></td></tr></div></div></body></html><?include 'config.php';include 'opendb.php';?><?$query="SELECT * FROM pil";if(isset($_GET['sortby'])){$query .= " ORDER BY '" . $_GET['sortby'] . "'";}$result=mysql_query($query);mysql_close();$num=mysql_numrows($result);$i=0;while ($i < $num) {$id=mysql_result($result,$i,"id");$date=mysql_result($result,$i,"date");$project_number=mysql_result($result,$i,"project_number");$resposible_individual=mysql_result($result,$i,"resposible_individual");$project_description=mysql_result($result,$i,"project_description");$county=mysql_result($result,$i,"county");$region=mysql_result($result,$i,"region");$client=mysql_result($result,$i,"client");// alternate #8F8F8F with #000000print ($i % 2) ? "<tr bgcolor=\"6699CC\">" : "<tr bgcolor=\"3399CC\">";print "<td>$id</td>";print "<td>$date</td>";print "<td>$project_number</td>";print "<td align='left'>$resposible_individual</td>";print "<td align='left'>$project_description</td>";print "<td align='left'>$county</td>";print "<td align='left'>$region</td>";print "<td align='left'>$client</td>";++$i;}?><?include 'closedb.php';?>[/code]I could get the "Prev" the page count and the "next" to show up, but the links don't work....Can someone just show me...?I appreciate it, thanks! Link to comment https://forums.phpfreaks.com/topic/31175-someone-add-pagination-to-this-for-me/ Share on other sites More sharing options...
thepip3r Posted December 19, 2006 Share Posted December 19, 2006 simply, u need to use MySQL Limit x,y and just replace x,y with the increments you want to use to display on a page. you'll also need to store the query statement for reparsing but it will work fine. Link to comment https://forums.phpfreaks.com/topic/31175-someone-add-pagination-to-this-for-me/#findComment-144073 Share on other sites More sharing options...
NoDoze Posted December 19, 2006 Author Share Posted December 19, 2006 ok, got this much so far...[code]<html><head><link href="../css/index.css" rel="stylesheet" type="text/css"><style type="text/css"><!--a:link , a:visited { color: #FFFFFF; text-decoration: none;}a:hover { color: #000000; text-decoration: none;}.table { font-family: Arial; font-size: 12px; color: #FFFFFF; text-decoration: none; text-align: center; border: 1px solid #000000; width: 100%;}.table-header { font-family: Arial; font-size: 12px; font-weight: bold; color: #FFFFFF; text-decoration: none; text-align: center; background-color: #0554A3;}.prodatabase { text-decoration: none; font-family: Arial; font-size: 10pt; color: #FFFFFF; position: absolute; left: 25px; top: 70px; width: 970px;}.page { text-decoration: none; font-family: Arial; font-size: 10pt; color: #FFFFFF; position: relative; bottom: 0px; height: 25px; width: 500px; text-align: center;}--></style></head><body bgcolor="#0554A3" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"><div class="text-header">Project Initiation Database</div><div class="prodatabase"><table class="table"><tr class="table-header"><td><a href="pil-view.php?sortby=id">ID</a></td><td><a href="pil-view.php?sortby=date">Initiation Date</a></td><td><a href="pil-view.php?sortby=project_number">Project Number</a></td><td><a href="pil-view.php?sortby=resposible_individual">Responsible Individual</a></td><td><a href="pil-view.php?sortby=project_description">Project Description</a></td><td><a href="pil-view.php?sortby=country">County</a></td><td><a href="pil-view.php?sortby=region">Region</a></td><td><a href="pil-view.php?sortby=client">Client</a></td></tr></div></div></body></html><?include 'config.php';include 'opendb.php';?><?if(!isset($_GET['page'])){ $page = 1; } else { $page = $_GET['page']; }$max_results = 5;$from = (($page * $max_results) - $max_results);$query="SELECT * FROM pil LIMIT $from, $max_results";if(isset($_GET['sortby'])){$query .= " ORDER BY '" . $_GET['sortby'] . "'";}$result=mysql_query($query);mysql_close();$num=mysql_numrows($result);$i=0;while ($i < $num) {$id=mysql_result($result,$i,"id");$date=mysql_result($result,$i,"date");$project_number=mysql_result($result,$i,"project_number");$resposible_individual=mysql_result($result,$i,"resposible_individual");$project_description=mysql_result($result,$i,"project_description");$county=mysql_result($result,$i,"county");$region=mysql_result($result,$i,"region");$client=mysql_result($result,$i,"client");// alternate #8F8F8F with #000000print ($i % 2) ? "<tr bgcolor=\"6699CC\">" : "<tr bgcolor=\"3399CC\">";print "<td>$id</td>";print "<td>$date</td>";print "<td>$project_number</td>";print "<td align='left'>$resposible_individual</td>";print "<td align='left'>$project_description</td>";print "<td align='left'>$county</td>";print "<td align='left'>$region</td>";print "<td align='left'>$client</td>";++$i;}?><?include 'closedb.php';?>[/code]So the query is limited, but now where/how do I intergrate the next, page numbers, and prev? Link to comment https://forums.phpfreaks.com/topic/31175-someone-add-pagination-to-this-for-me/#findComment-144079 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.