What is the shortest way to verify a record and insert it if it does not exist?
😕
Originally posted by netrepsa What is the shortest way to verify a record and insert it if it does not exist? 😕
shortest??? ok then
if (!mysql_query_first("SELECT * FROM table WHERE this='that'")) { mysql_query("INSERT INTO table SET value1=this,value2=that,value3=etc"); }
the code returns the following:
Fatal error: Call to undefined function: mysql_query_first() in /home/specgame/public_html/update.php on line 44
Originally posted by netrepsa the code returns the following: Fatal error: Call to undefined function: mysql_query_first() in /home/specgame/public_html/update.php on line 44
I mean mysql_query()
is there an error code to test success of transaction?
netrepsa: mysql_query() will return a false if it encounters an error.