title: MySQL UPDATE Query Syntax Error?
body: <p>I am relatively new to MySQL and PHP and I have been trying to UPDATE a table for a very long time now, I've searched Google and SO and I still can't figure it out.</p>
  <p>Here is the php:</p>
  <pre><code>$info = array('about_me' =&gt; NULL, 'profile_pic' =&gt; NULL, 'political_party' =&gt; NULL,         'econ_views' =&gt; NULL, 'religious_views' =&gt; NULL, 
  'abortion_view' =&gt;NULL,'gay_marraige' =&gt; NULL, 'other' =&gt; NULL);
  
  foreach ($_POST as $key =&gt; $value) {
      $info[$key] = mysql_escape_string($value);
  }
  
  $about_me = $info['about_me'];
  $profile_pic = $info['profile_pic'];
  $econ_views = $info['econ_views'];
  $religious_views = $info['religious_views'];
  $abortion_view = $info['abortion_view'];
  $gay_marraige = $info['gay_marraige'];
  $other = $info['other'];
  $political_party = $info['political_party'];
  
  //Connect to database
  require 'db.php';
  
  $query = &quot;UPDATE `users` SET `about_me`=$about_me, `profile_pic`=$profile_pic,   `econ_views`=$econ_views,
         `religious_views`=$religious_views,`abortion_view`=$abortion_view,`gay_marriage`=$gay_marraige, 
      `other`=$other, `political_party`=$political_party WHERE `username`=emoore24&quot;;
  
  echo &quot;$query&quot;.&quot;&lt;br /&gt;&lt;br /&gt;&quot;;
  $result = mysql_query($query) or die(mysql_error());
  
  echo &quot;success&quot;
  </code></pre>
  <p>This is run on a form with many text areas and one select element.  I ran everything with simple strings as data and got this:</p>
  <blockquote>
  <p>UPDATE <code>users</code> SET <code>about_me</code>=test about, <code>profile_pic</code>=, <code>econ_views</code>=test econ,  <code>religious_views</code>=test rel,<code>abortion_view</code>=test abortion,<code>gay_marriage</code>=test gay marraige, <code>other</code>=test other, <code>political_party</code>=democrat WHERE <code>username</code>=emoore24</p>
  <p>You have an error in your SQL syntax; check the manual that corresponds to your MySQL &gt;server version for the right syntax to use near ' <code>econ_views</code>=test econ, &gt;<code>religious_views</code>=test rel,<code>abortion_view</code>=test abor' at line 1</p>
  </blockquote>
  <p>I'm assuming that it's something small, but I can't see it.  Could anyone help?</p>