Reputation: 10117
Having some trouble getting this query to work correctly.
mysql_query("DELETE FROM `table` WHERE `id` = '$id' AND 'username' = '$username' ");
tried replacing variables with actual data and running it in phpmyadmin to no success
any thoughts?
Upvotes: 3
Views: 13161
Reputation: 50642
Please, for the love of the internet, don't built an SQL query yourself. Use PDO.
Upvotes: 1
Reputation: 29303
You're quoting the username column with ' instead of `
use:
mysql_query("DELETE FROM `table` WHERE `id` = '$id' AND `username` = '$username'");
not:
mysql_query("DELETE FROM `table` WHERE `id` = '$id' AND 'username' = '$username'");
Upvotes: 17