php mysql query infinite loop
Posted by: gsf
Posted on: 2005-07-15 14:17:00
I was working on a php script last night and I forgot to change a variable in a while loop I was adapting. Here's how it looked:
$recEngID = strtok($recEngList, ",");
while ($recEngID !== false) {
$query = "INSERT INTO SongRecEngRelation ";
$query .= "(SongID, RecEngID) ";
$query .= "VALUES ($songID, $recEngID)";
$result = mysql_query($query);
$albumID = strtok(",");
}
So, $albumID should have been $recEngID, but because it wasn't, the loop became an infinite one, sending identical query after identical query. I tried to kill it through the shell and the web panel, but couldn't figure out how to get to a cgi process. The inserts finally stopped after a few hundred thousand queries, because the connection was closed by the database, I assume.
Is there anyway to kill the process if I make the same mistake again?
gabe