PHP-MySQL-Class icon indicating copy to clipboard operation
PHP-MySQL-Class copied to clipboard

Insert if not exist value

Open masadi opened this issue 10 years ago • 1 comments

Is there a function to INSERT rows when there is no, or UPDATE if exists, using one MySQL query?

masadi avatar Oct 01 '13 08:10 masadi

I don't think one exists in the Class but for the SQL syntax check http://stackoverflow.com/a/6853256/1634384 and you can use that with ExecuteSQL within the class to execute it. Keep in mind that the input won't be sanitized so make sure to use mysql_real_escape_string().

ghost avatar Dec 21 '13 04:12 ghost