title: PHP MySQL UPDATE statement not working
body: <p>I have a MySQL database with a table (opendpu) that has multiple columns including columns titled "ECRNUM" and "PE_REQUIRED".</p>
  
  <p>I'm simply trying to <strong>test</strong> this update statement by specifying some values. I get this error:</p>
  
  <blockquote>
    <p>Array ( [0] => 42000 [1] => 1064 [2] => 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 'DOE WHERE ECRNUM = 81308' at
    line 1 )</p>
  </blockquote>
  
  <p>I cannot, for the life of me, figure out what is wrong here. Can anyone help?</p>
  
  <pre><code>&lt;?php
    require ('config.php');
   $ecrno = '81308';
   $pe_required = 'JOHN DOE';
  
  while (true) {
  try {
      $db = new PDO($dsn, $uname, $pword);
      $db-&gt;exec( "SET CHARACTER SET utf8" );
      $db-&gt;setAttribute( PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC ); 
      $db-&gt;setAttribute( PDO::ATTR_PERSISTENT, true );
      break;
  }
      catch (Exception $e) {
          $db = null;
          $counter++;
          if ($counter == $limit)
              throw $e;
      }
  }
  
  $stmt = $db-&gt;prepare("UPDATE opendpu SET PE_REQUIRED = $pe_required WHERE ECRNUM = $ecrno");
  $stmt-&gt;execute() or die(print_r($stmt-&gt;errorInfo(), true));
  
    ?&gt;
  </code></pre>
  
  <p>.</p>