Bringing in rows
| From: | bryan | Date: | Tue, 05 Dec 2000 17:44:04 +0000 |
| Subject: | Bringing in rows | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-5025@lists.php.net to get a copy of this message | ||
Hello, I have a problem that I am unsure of how to fix. I am able to bring
in as many rows as I want to, through a regular query, but when I use
offset, more records are not being displayed. There is a 99.9% chance the
error lies within, so could anyone help me with this problem?
SYNTAX:
<?php
if( isset($HTTP_GET_VARS["off"]) ) {
$iOffset = $HTTP_GET_VARS["off"];
} else {
$iOffset = "0";
}
$iLimit = "10";
$iIncrement = $iOffset + 10;
mysql_select_db( "cfactory" );
$mquery = "SELECT * FROM messages order by date DESC LIMIT $iLimit";
$mquery2 = "SELECT * FROM messages order by date DESC LIMIT
$iLimit, $iOffset";
$mresult = mysql_query($mquery,$dbcnx);
$mresult2 = mysql_query( $mquery2, $dbcnx );
$numrows2 = mysql_num_rows( $mresult2 );
if ($iLimit >= 10) {
print "<a href=\"content.php?off=".($iOffset+10)."\">Show Last
$iIncrement</a>";
}
if ($iOffset > 10) {
print "<a href=\"content.php?off=".($iOffset-10)."\">Most
Recent</a>";
}
?>
Thanks, bryan
Bryan Fitch
Programmer
Concept-Factory
http://www.concept-factory.com
bryan@concept-factory.com