title: Learning PDO queries
body: <p>FIXED!
  The problem was I didn't know you had to initialize a connection to PDO separate from a normal connection: </p>
  
  <pre><code>$dbh = new PDO('mysql:host=localhost;dbname=test', $user, $pass);
  </code></pre>
  
  <p>I'm trying to learn PDO for security purposes + just good practices. Is this correct on how I would translate an insert query into PDO? It doesn't seem to be working. $dbh has to be my connection to the server correct? </p>
  
  <pre><code>     $stmt = $dbh-&gt;prepare("INSERT INTO users (social_id, name, email, social_network, profile_pic) VALUES (:social_id, :name, :email, :social_network, :profile_pic)");
                          $stmt-&gt;bindParam(':social_id', $social_id);
                          $stmt-&gt;bindParam(':name', $name);
                          $stmt-&gt;bindParam(':email', $email);
                          $stmt-&gt;bindParam(':social_network', $social_network);
                          $stmt-&gt;bindParam(':profile_pic', $profile_pic);
  
                          // insert one row
                          $stmt-&gt;execute(); 
  
                          $user_id = $dbh-&gt;lastInsertId();    
  </code></pre>
  
  <p>From this:</p>
  
  <pre><code>                          mysql_query("INSERT INTO users (social_id, name, email, social_network, profile_pic)
                                              VALUES ('$social_id', '$name','$email', '$social_network','$profile_pic')");                
  
                              $user_id = mysql_insert_id();
  </code></pre>