Rahul Singh
Rahul Singh

Reputation: 1632

Error with query in mysql database

Can't I use double condition in where clause in query. LIke I have used query..

 mysql_query("DELETE * FROM srelsg WHERE skey='".$childid."' AND sgkey='".$sgid."' ") or die(mysql_error());

but its giving me syntax error. Might be I am using double variables in WHERE for delete query. Any other solution I can do it. Because combination of both variable make my tupple unique. else both field exist number of times.

Upvotes: 1

Views: 43

Answers (2)

Ed Heal
Ed Heal

Reputation: 59997

In addtion to Mark Byers - use mysql_real_escape_string

http://php.net/manual/en/function.mysql-real-escape-string.php

Upvotes: 0

Mark Byers
Mark Byers

Reputation: 838006

There should not be a * between DELETE and FROM. Change this:

DELETE * FROM srelsg WHERE ...

To this:

DELETE FROM srelsg WHERE ...

See the DELETE syntax in the MySQL manual.

Upvotes: 6

Related Questions