I have two conditions in a DELETE MySQL statement. But it does not delete the record.
$sql="DELETE * FROM sportevent.event_registrations WHERE event_registrations.id = '$id' AND event_registration.eventname = $event";
Is there something wrong with my query? It works if I use only one WHERE condition, but I need to use two.
I suspect this:
event_registration.eventname = $event
should be
event_registrations.eventname = $event
After all, you've used the plural form in both the "from" clause and the other part of the "where".
Also note that only one of your parameters is quoted - it's not clear to me how you're providing the parameters, but surely you should be consistent.
Try this
$sql="DELETE FROM sportevent event_registrations WHERE event_registrations.id = '$id' AND event_registrations.eventname = $event";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With