Menu
This is what I’m trying to do:
– Delete the first table row (id=1)
– Rename the new first row (id=2) to id=1
– Rename the new second row (id=3) to id=2
– etc…all the way to id=100
This is how far I’ve got:
$cid = mysql_query(“SELECT count(id) FROM table”);
$r = mysql_fetch_row($cid);
$rowcount = $r[0];
if ($rowcount > 100) {
$cid = mysql_query(“DELETE FROM table WHERE id = 1”);
for ($x=1; $x<=$rowcount; $x++)
{
$newid = $x–;
$update = mysql_query(“UPDATE table SET id=’$newid’ WHERE id=’$x'”);
}
It seems to produce an internal server eror: how do i fix it?