Reputation: 33
my problem is that I want to delete one record on my table "provicional" if "Id" and "Password" match... i have a simple code but just work for ID and I want to delete it if both match!
$sql = "DELETE FROM `provicional` WHERE `id` IN ('3','basico')";
many thanks for any help
Upvotes: 0
Views: 326
Reputation: 43464
A not so popular way of doing this in MySQL would be:
DELETE FROM provicional WHERE (id, password) = (3, 'basico')
Note you can add more than just 2 elements in each list.
Tip: Do not use apostrophes '
around numeric fields.
Upvotes: 2
Reputation: 3896
$sql = "DELETE FROM `provicional` WHERE `id` IN ('3') AND `password` IN ('basico')";
Upvotes: 1