Not Deleting Record
Posted: Sun Jun 27, 2010 10:38 am
The following code is a section from a SWITCH command that should delete a record from the relevant table:
The resultant instruction is given as DELETE FROM tblarticles WHERE ID = 2, which, if I enter directly into mySQL does indeed delete the record with the ID = 2. Yet, all this does is select the ELSE instruction.
The section of code used for the actual query is:
Any ideas why this keeps failing?
Code: Select all
$deletQuery = "DELETE FROM ".$settings['tbl_articles']." WHERE ID = ".$HTTP_GET_VARS['id'];
if ($result = $connector->query($deleteQuery))
{
header("Location: index.php");
}
else
{
echo "DELETE FROM ".$settings['tbl_articles']." WHERE ID = ".$HTTP_GET_VARS['id'];
echo('<center>Sorry, there was an error deleting from the database</center>');
}
The section of code used for the actual query is:
Code: Select all
// Execute a database query
function query($query)
{
$this->theQuery = $query;
return mysql_query($query, $this->link);
}