title: PDO Error with function
body: <p>Hello i am using PDO 1st time and getting error ... dont no where am i wrong here is my code</p>
  
  <pre><code>function student_one_image($student_id){
      $DBH = new PDO("mysql:host=$host;dbname=$dbname", $user, $pass);
      $STH = $DBH-&gt;query("SELECT * from school_students, school_student_one_image where (school_student_one_image.student_id = school_students.student_id) 
      and school_student_one_image.student_id = '$student_id'");
      $STH-&gt;setFetchMode(PDO::FETCH_ASSOC);
      $row = $STH-&gt;fetch();
      return $row 
  </code></pre>
  
  <p>error is Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock</p>
  
  <p>and if i am trying using mysql it work </p>
  
  <pre><code>function student_one_image($student_id){
      $data= mysql_query("SELECT * from school_students, school_student_one_image where (school_student_one_image.student_id = school_students.student_id) 
      and school_student_one_image.student_id = '$student_id'");
      $result = mysql_fetch_array($data);
      return $result; 
  </code></pre>
  
  <p>please help</p>