Page 1 of 1

Determine The End Of The Database

Posted: Fri Oct 07, 2005 1:59 pm
by icesolid
How do you determine the end of a MySQL database?

I want an action to occur once the end of the database is reached

Posted: Fri Oct 07, 2005 2:01 pm
by feyd
end of the database? Do you mean the end of the query results?

:?

Here's What I Have

Posted: Fri Oct 07, 2005 2:05 pm
by icesolid
Heres what I have:

Code: Select all

<?php
$limit = "20";
$result = mysql_query("SELECT * FROM statistics ORDER BY id DESC LIMIT $offset,$limit");

if(mysql_num_rows($result) == $row["id"]) {
// what to display here
} else {
// what to display here
}
?>

Posted: Fri Oct 07, 2005 2:11 pm
by feyd
normally, processing of a result set is done with a loop.

Code: Select all

<?php
$limit = "20";
$result = mysql_query("SELECT * FROM statistics ORDER BY id DESC LIMIT $offset,$limit");

while($row = mysql_fetch_assoc($result)) {
// code here is for stuff during each result of the result set
}
// you'll be here immediately after the last result is processed from the result set

?>