PDA

View Full Version : Resolved Delete row based on two fields


sonny
08-13-2009, 08:50 PM
Hi I have a delete from query by a keyword in "field url"

My question is...
I would like to delete the entry row containing that keyword
but only if vcode="0"


This does not seem to work

$dkey="%".$keyword."%";
mysql_query("DELETE FROM visits WHERE url LIKE '$dkey' && vcode='0'");

Any help is appreciated
Thanks

Old Pedant
08-13-2009, 10:22 PM
&& is not a valid operator.

Just use AND.

Also, if vcode is a NUMERIC field of any kind (bit, int, tinyint, etc.) then so *NOT* use apostrophes around the value you test against.


DELETE FROM visits WHERE url LIKE '$dkey' AND vcode=0

sonny
08-13-2009, 10:43 PM
&& is not a valid operator.

Just use AND.

Also, if vcode is a NUMERIC field of any kind (bit, int, tinyint, etc.) then so *NOT* use apostrophes around the value you test against.


DELETE FROM visits WHERE url LIKE '$dkey' AND vcode=0


That did it
Thank You