title: PDO Update with variable table, column, row
body: <p>I would like to build an ajax function that updates field variables in some tables.
  The tables, fields, and rows are all variable and based on what is posted via the ajax function. </p>
  
  <p>This is the code for my quickedit.php</p>
  
  <pre><code>define( "DB_DSN", "mysql:host=$host;dbname=$data" );
  define( "DB_USERNAME", $user );
  define( "DB_PASSWORD", $pass );
  
  if(isset($_POST['table'])){ $table = $_POST['table'];}
  if(isset($_POST['id'])){ $id = $_POST['id'];}
  if(isset($_POST['field'])){ $field = $_POST['field'];}
  if(isset($_POST['value'])){ $value = $_POST['value'];}
  
  try {
      $con = new PDO( DB_DSN, DB_USERNAME, DB_PASSWORD );
  } catch (Exception $e) {
      die("Connection Error");
  }
  
  try {
      $st = $con-&gt;prepare("UPDATE :table SET :field = :value WHERE id = :id");
      $st-&gt;execute(array(':table'=&gt;$table, ':id'=&gt;$id, ':field'=&gt;$field, ':value'=&gt;$value));
  } catch (Exception $e) {
      die("Query Error");
  }
  echo "table: ".$table." id: ".$id." field: ".$field." value: ".$value;
  </code></pre>
  
  <p>As you can see, I wish to dynamically select the table, column, and row.</p>
  
  <p>I'm don't know a whole lot about exceptions, but none of them are being thrown
  and it is successfully echoing the stuff at the bottom i told it to.</p>