Sunday, 15 June 2014

php - where not exist mysql -



php - where not exist mysql -

when visits site, want log users ip, when arrive site table might not exist, update query gives me error. , need check against existing tables. i've tried: reading, none seems cover problem, if table dont exist. it's typo.

$db->query("insert track (tm, user_agent, host, ip, port, lang) values ('$tm','$user_agent','$host','$ip','$port','$lang') not exists ( select ip track ip='$ip'");

you want @ insert ... on duplicate key update syntax allows specify action if key present

php mysql

No comments:

Post a Comment