Click here to Skip to main content
15,885,875 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi ALL,

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?
-Many thanks

$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);
Posted

1 solution

hi,

Use IS NULL instead, I think this will solve your problem.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900