Reputation: 25
$select1 = mysqli_query($conn, "SELECT robotid FROM robotidsz ORDER BY robotid DESC LIMIT 1");
for ($i = $select1; $i <= 9999999; $i++) {
Above is my code, this should search from the last "RobotID known in the table to 9999999.
If i change $select1 to 1000000 this functions from 1000000-9999999 correctly however using this code nothing happens?
Upvotes: 0
Views: 710
Reputation: 53198
You need to extract the result from your query. At the moment, you're assigning $i
an initial value of the Resource
returned.
The following demonstrates how to solve this:
$select1 = mysqli_query($conn, "SELECT robotid FROM robotidsz ORDER BY robotid DESC LIMIT 1");
$result = mysqli_fetch_object($select1);
for ($i = $result->robotid; $i <= 9999999; $i++)
{
// Do your stuff...
}
Upvotes: 3