title: mySql to PDO snippet
body: <p>Having difficulty finding info on how to rewrite this mySql line into PDO:</p>
  
  <pre><code>if ($_GET["action"] == "list")
  </code></pre>
  
  <p>In the code I am trying to convert, four if/else statements look similar to this:</p>
  
  <pre><code>if ($_GET["action"] == "create") {
          //Insert record into database
          $result = mysql_query("INSERT INTO people(Name, Age, RecordDate) VALUES('" . $_POST["Name"] . "', " . $_POST["Age"] . ",now());");
  
          //Get last inserted record (to return to jTable)
          $result = mysql_query("SELECT * FROM people WHERE PersonId = LAST_INSERT_ID();");
          $row = mysql_fetch_array($result);
  
          //Return result to jTable
          $jTableResult = array();
          $jTableResult['Result'] = "OK";
          $jTableResult['Record'] = $row;
          print json_encode($jTableResult);
      }
  </code></pre>