Page 1 of 1

Unable to perform a delete from MySQL Database

Posted: Thu Jul 10, 2003 4:44 pm
by Gilimi
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

Posted: Thu Jul 10, 2003 7:00 pm
by DuFF
Try this:

Code: Select all

DELETE FROM rants WHERE index='$index'
Not sure if that will fix it but its worth a try.

Posted: Thu Jul 10, 2003 8:18 pm
by m3mn0n
:!:

I just want to add that there is a Database forum for a reason.

:!:

Posted: Thu Jul 10, 2003 8:47 pm
by Gilimi
I am sorry about that. I am a newbie and didn't notice till after I posted. I will try to be more aware next time.

Joe