Justtechjobs.com Find a programming school near you






Online Campus Both


php-db | 2000121

[PHP-DB] Bringing in rows From: bryan (bryan <email protected>)
Date: 12/05/00

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 <email protected>

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe <email protected>
For additional commands, e-mail: php-db-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>