jarv Posted July 24, 2010 Share Posted July 24, 2010 ok here is my code <?php include_once("config.php"); include_once("functions.php"); // Check user logged in already: checkLoggedIn("yes"); //doCSS(); $offset = $_REQUEST["start"]; $rowsPerPage = $_REQUEST["count"]; $query = "SELECT * FROM pubs LIMIT $offset, $rowsPerPage"; $result = mysql_query($query) or die(mysql_error().'<br>SQL: ' . $query); // start main page while($row = mysql_fetch_array($result)){ $PUBID = $row['PUBID']; $RSPUBNAME = $row['RSPUBNAME']; $RSADDRESS = $row['RSADDRESS']; $RSPOSTCODE = $row['RSPOSTCODE']; $RSTEL = $row['RSTEL']; $RSTOWN = $row['RSTOWN']; $RSCOUNTY = $row['RSCOUNTY']; // how many rows we have in database // print the link to access each page $self = $_SERVER['PHP_SELF']; $next = "<li><a href=\"all.php?start=20&count=10\" target=\"_replace\">View More</a></li>"; //div container of header and information echo <<<EOF <li><a href="#">$RSPUBNAME</a></li> EOF; if ($_SESSION["RSUSER"] == "admin") { echo "<a href=\"edit.php?PUBID=$PUBID\" class=\"small\">edit this pub</a>"; } } echo $next; ?> the first time I click on View More it works, if i do it again, it just shows the previous 10 records, please help? Link to comment https://forums.phpfreaks.com/topic/208778-paging-10-new-records-at-a-time/ Share on other sites More sharing options...
jcbones Posted July 24, 2010 Share Posted July 24, 2010 $offset = (isset($_GET['start'])) ? (int)$_GET["start"] : 0; $rowsPerPage = (isset($_GET['count'])) ? (int)$_GET["count"] : 10; $next = "<li><a href=\"all.php?start=" . ($offset + $rowsPerPage) . "&count={$rowsPerPage}\" target=\"_replace\">View More</a></li>"; Link to comment https://forums.phpfreaks.com/topic/208778-paging-10-new-records-at-a-time/#findComment-1090684 Share on other sites More sharing options...
jarv Posted July 24, 2010 Author Share Posted July 24, 2010 thank you very much JCbones Link to comment https://forums.phpfreaks.com/topic/208778-paging-10-new-records-at-a-time/#findComment-1090697 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.