MySQL select and insert help? Trying to do something like this:
$result = mysql_query("INSERT INTO experiments (ip, timestamp) VALUES ('$ip', '$time') WHERE NOT EXISTS (SELECT * FROM experiments WHERE ip = '$ip'");
(get all the ip from experiments if none of the ip match $ip run the insert)
I could do it with multiple queries but i'd rather do it in one if possible... I have no idea what i'm doing though. |