tags:

views:

156

answers:

2

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?

+11  A: 

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'");
hobodave
+1  A: 

Please, for the love of the internet, don't built an SQL query yourself. Use PDO.

Paul Tarjan