Good day:
I'm creating a form to write SEO into my php page head and have run into a block on the mysql_query() UPDATE function. I just cannot seem to get it to write multiple fields in a row.
What I've done so far is as follows:
<?
if ($_POST['seo'] == Save) {
$data = mysql_real_escape_string(trim($_POST['data']));
$res = mysql_query("UPDATE seo_en SET (".title." ".description.", ".keywords.") = '".$data."' WHERE id = 1");
if (!$res)
die("Error saving the record! Mysql said: ".mysql_error());
header("Location: home.php");
}
$query = mysql_query("SELECT 'title', 'description', 'keywords' FROM content_en WHERE id = 1");
$data = mysql_fetch_array($query);
?>
<form name="seo" action="home.php" method="post">
Title: <input size="66" type="text" name="title[]" id="title[]" value="<? echo $data['title']; ?>"><br/>
Description: <input size="100" type="text" name="description[]" id="description[]" value="<? echo $data['description']; ?>"><br/>
Keywords: <input size="100" type="text" name="keywords[]" id="keywords[]" value="<? echo $data['keywords']; ?>"><br>
<input type="submit" name="seo" value="Save" />
</form>
With the code above, I can read data from the 3 fields into INPUT fields, but cannot write back on Save.
The MySQL error I receive is as follows:
Error saving the record! Mysql said: 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 '(title description, keywords) = '' WHERE id = 1' at line 1
My scripts work fine in every way, but I just cannot get teh SYNTAX down for the $res line.
Any help would be greatly appreciated.
Best Regards,
dennishall