Jump to content

Recommended Posts

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

$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>";

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.