php SQL INSERT INTO WHERE NOT EXISTS?

  • Thread starter Thread starter xserxresx
  • Start date Start date
X

xserxresx

Guest
Please can someone help me with an issue I am having with the INSERT INTO WHERE NOT EXISTS Function. Here is my code so far:

$query = ("INSERT INTO document_association2 (name) VALUES ('$groupname') WHERE NOT EXISTS (document_association2.name = '$groupname'");
$result = mysql_query($query)
or die("error: ".
mysql_error());

I am wishing to insert a new row into document_association2 but only if if an item in the column 'name' is not already existing.

Thank you
 
Back
Top