From the script below, I get the following error:
Warning: Supplied argument is not a valid MySQL result resource in /home/floorgaz/public_html/links/reID.php on line 14
now, it DOES change the id number like it is supposed to do in the script but it always ends up with that error. And when I hit refresh as many times as how many rows there is in that table, that table will disappear and when i look, all the IDs are all in order from 1 to whatever number. What's up with this?!
Here's the script below:
<?php
print "\n<head>";
// Whatever heading
print "</head>\n\n<body>\n\n\n\n";
require ("includes.php");
// SET VARIABLES
$count = 0;
$result = mysql_query("SELECT * FROM crewInfo");
while ($row = mysql_fetch_array($result))
{
$count++;
$newId = $row['id'];
//IF THE CURRENT $count NUMBER IS NOT EQUAL TO THE CURRENT ROW ID: $newId
if ($count != $newId)
{
//THEN IT WILL CHANGE IT TO $count
$result = mysql_query("UPDATE crewInfo SET id='$count' WHERE id='$newId'");
}
}
print "\n</body>\n\n\n";
?>