I ran a script I made a couple of minutes ago and it still hasn't finished running.
Now it has, I got a 500 Internal Server Error.
EDIT--- The error is occuring on line 126 which is port of the while loop here:
while ($row == mysql_fetch_assoc($query)) {
mysql_query("DELETE FROM `Likes` WHERE `accountID` = '$id'");
}
Please can you tell me what is causing my script to be so slow?
if ($param == "closeAccount") {
$username = NULL;
$password = NULL;
$emailAdd = NULL;
$id = NULL;
if (isset($_GET['username'])) {
$username = $_GET['username'];
}
else {
exit("No username is set");
}
if (isset($_GET['password'])) {
$password = md5($_GET['password']);
}
else {
exit("No password is set");
}
if (isset($_GET['emailAddress'])) {
$emailAdd = $_GET['emailAddress'];
}
else {
exit("No email address is set");
}
$query = mysql_query("SELECT * FROM `Accounts` WHERE `Username` = '$username' AND `Password` = '$password' AND `Email Address` = '$emailAdd'");
if (mysql_num_rows($query) < 1) {
exit("Account doesn't exist");
}
while ($row = mysql_fetch_assoc($query)) {
$id = $row["id"];
}
$query = NULL;
$query = mysql_query("SELECT `id` FROM `Comments` WHERE `accountID` = '$id'");
while ($row = mysql_fetch_assoc($query)) {
mysql_query("DELETE FROM `Comments` WHERE `accountID` = '$id'") or die(mysql_error());
}
$query = NULL;
$query = mysql_query("SELECT `id` FROM `Likes` WHERE `accountID` = '$id'");
while ($row == mysql_fetch_assoc($query)) {
mysql_query("DELETE FROM `Likes` WHERE `accountID` = '$id'");
}
$query = NULL;
$query = mysql_query("SELECT `id` FROM `Posts` WHERE `accountID` = '$id'");
while ($row == mysql_fetch_assoc($query)) {
mysql_query("DELETE FROM `Posts` WHERE `accountID` = '$id'");
}
$query = NULL;
$query = mysql_query("DELETE FROM `Accounts` WHERE `Username` = '$username' AND `Password` = '$password' AND `Email Address` = '$emailAdd'");
exit("Closed");
}