I am kind of confused with the WHERE NOT EXISTS in mysql. I used this syntax in php editor: I want to insert records one by one from one table (in a while) to a tmp table and I want to check before inserting if the url is exists in tmp or not if exists I dont want to insert if not exist I wnat to insert this is a code I end up with it!!!but It doesnt insert even when the tmp table is empty....any suggestion?
$INSERT_SQL=(INSERT INTO tmp (company_name,link)
SELECT ($comp_name,$url) WHERE NOT EXISTS (SELECT * FROM TMP WHERE link=$url));
$result2 = mysql_query($INSERT_SQL,$con);