Unable to perform a delete from MySQL Database
Posted: Thu Jul 10, 2003 4:44 pm
Good Day all,
I know that this should be a simple task, but for some reason I cannot get it to work without an error.
I have a table with three fields, index an autoincrement number, date (a date) and text that holds just general garble) I worte a PHP script that creates a form and each entry is assigned to a radio button. The idea is that the user will select the radio button of the entry s/he wants to delete. Now the value of the radio button is set to the index value of the row it is being generated from.
Now when they click the delete record button, the index value is correctly passed to the delete script. I generate a query that looks like this:
DELETE FROM rants WHERE 'index' = '$index'
I don't get a PHP or MySQL error but it returns 0 rows indicating that it did not delete the record. I have printed out the generated query and all looks fine. What am I missing here to get a record deleted?
Any help is greatly appreciated.
Warm Regards,
Joe
I know that this should be a simple task, but for some reason I cannot get it to work without an error.
I have a table with three fields, index an autoincrement number, date (a date) and text that holds just general garble) I worte a PHP script that creates a form and each entry is assigned to a radio button. The idea is that the user will select the radio button of the entry s/he wants to delete. Now the value of the radio button is set to the index value of the row it is being generated from.
Now when they click the delete record button, the index value is correctly passed to the delete script. I generate a query that looks like this:
DELETE FROM rants WHERE 'index' = '$index'
I don't get a PHP or MySQL error but it returns 0 rows indicating that it did not delete the record. I have printed out the generated query and all looks fine. What am I missing here to get a record deleted?
Any help is greatly appreciated.
Warm Regards,
Joe