Re: maximum time
| From: | Kenneth Bogucki | Date: | Wed, 19 Jul 2000 17:05:34 +0000 |
| Subject: | Re: maximum time | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-7313@lists.php.net to get a copy of this message | ||
I don't know if your response answers the orginal question, but it sure
answers the question was was just getting ready to post....
thanks
ken
> // $conn is the link identifier to the MySQL server
> if( !isset($row) || $row == "" )
> $row = 0; // number of the first row to show
> if( $row < 0 )
> $row = 0;
> if( !isset($rxp) || $rxp == "" )
> $rxp = 10; // rows to shwo in each page
>
> $sql = "SELECT * FROM <table_name>";
> $result = mysql_query($sql, $conn);
> $numrows = mysql_num_rows($result);
> $numpages = floor( ($numrows - 1) / $rxp + 1 );
> // now you know how many records you have and the number of
> // pages you'll need to show them
>
> $sql .= " LIMIT $row, $rxp";
> $result = mysql_query($sql, $conn);
> // so the query gives you only $rxp records
> // every time you perform it
> ....
> now you show your records
> ....
> // Now put a link to the previous and next pages...
> echo "<a
> href=\"$PHP_SELF?row=".($row-$rxp)."&rxp=$rxp\">".
> "<<< indietro</a>";
> echo "<a
> href=\"$PHP_SELF?row=".($row+$rxp)."&rxp=$rxp\">".
> "avanti >>></a>";
> Use this code as you like, if you can't understand let me know...
> Ciao
> Cesare
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net