I cannot figure out what is wrong. My query looks like this:
INSERT OR REPLACE INTO lang (name, string, lang) VALUES ('PAGE_TITLE', 'Page Title', 'en')
And this is where I execute that query:
foreach($lang_fields as $field){
$update = "INSERT OR REPLACE INTO lang (name, string, lang)
VALUES ('".mysqli_real_escape_string($conn, $field)."',
'".mysqli_real_escape_string($conn, $_POST[$field])."',
'".mysqli_real_escape_string($conn, $_POST['lang_load'])."')";
echo $update;
$sql = mysqli_query($conn, $update)
or die(mysqli_error($conn));
}
And this is the error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'OR REPLACE INTO lang (name, string, lang) VALUES ('PAGE_TITLE', 'P' at line 1
INSERT OR REPLACE INTOthey are separate statements dev.mysql.com/doc/refman/5.6/en/insert.html and dev.mysql.com/doc/refman/5.6/en/replace.html