title: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]
body: <p>I converted the following working code:</p>
  
  <pre><code>&lt;?php
      include('config.php');
      $link = mysql_connect($db_host, $username, $password);
      mysql_select_db($db_name);
  
      $id= $_POST["uniqi"];
      $comments= $_POST["comments"];
      $comments= mysql_real_escape_string($comments);
      $comments = strip_tags($comments);
  
      $update = "UPDATE mastertable SET comments = '$comments' WHERE id_pk= '$id'";
      mysql_query($update, $link);
      mysql_close();
      header('Location: ccccc.com/pabrowser/… Updated');
  ?&gt;
  </code></pre>
  
  <p>to PDO:</p>
  
  <pre><code>&lt;?php
      $id= $_POST["uniqi"];
      $comments= $_POST["comments"];
      $conn = new PDO("mysql:host=$db_host;dbname=$db_name", $username, $password);
  
      $sql = "UPDATE mastertable SET comments=?    WHERE id_pk=?";
      $q = $conn-&gt;prepare($sql);
      $q-&gt;execute(array($comments, $id));
  
      header('Location: ccccc.com/pabrowser/… Updated');
  ?&gt;
  </code></pre>
  
  <p>Which gave me</p>
  
  <blockquote>
    <p>Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)' in /home/content/58/9508458/html/pabrowser/comsumcompro.php:4 Stack trace: #0 /home/content/58/9508458/html/pabrowser/comsumcompro.php(4): PDO->__construct('mysql:host=;dbn...', NULL, NULL) #1 {main} thrown in /home/content/58/9508458/html/pabrowser/comsumcompro.php on line 4</p>
  </blockquote>