When someone visits my site, i want to log the users ip, but when you arrive to the site the table might not exist, so the UPDATE query gives me an error. And I also need to check against existing tables. I've tried: reading, but none seems to cover this problem, if the table dont exist. It's probably a typo.
$db->query("INSERT INTO track (tm, user_agent, host, ip, port, lang) VALUES ('$tm','$user_agent','$host','$ip','$port','$lang') WHERE NOT EXISTS (
SELECT ip FROM track WHERE ip='$ip'");