How do you determine the end of a MySQL database?
I want an action to occur once the end of the database is reached
Determine The End Of The Database
Moderator: General Moderators
Here's What I Have
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
}
?>- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
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
?>