title: Using PDO to CREATE TABLE
body: <p>I am very new to php and this forum, so please excuse any errors or misplaced questions. 
  In the code i provided, I am just looking to CREATE a Table in the DB "mydb". I tested the connection to the DB(It works). It is just the creating the table i am having issues with.
  Any advice or criticisms would be appreciated. Thx</p>
  
  <pre><code>&lt;?php
  /*
  *
  * File:         PDOcreateTabletcompany.php
  * By:          Jay
  * Date:       24-10-13
  *
  *  This script createsTableintoDB
  *
  *====================================
  *
  */
  try {
      $db = new PDO("mysql:dbname=mydb;host=localhost", "root", "" );
  } catch(PDOException $e) {
      echo $e-&gt;getMessage();
  }
  $table= "tcompany";
  $columns = "ID INT( 11 ) AUTO_INCREMENT PRIMARY KEY, Prename VARCHAR( 50 ) NOT NULL, Name VARCHAR( 250 ) NOT NULL,
   StreetA VARCHAR( 150 ) NOT NULL, StreetB VARCHAR( 150 ) NOT NULL, StreetC VARCHAR( 150 ) NOT NULL, 
   County VARCHAR( 100 ) NOT NULL, Postcode VARCHAR( 50 ) NOT NULL, Country VARCHAR( 50 ) NOT NULL " ;
  
  
  $createTable = $db-&gt;exec("CREATE TABLE IF NOT EXISTS mydb.$table ($columns)");
  
  if ($createTable) 
  {
      echo "Table $table - Created!&lt;br /&gt;&lt;br /&gt;";
  }
  else { echo "Table $table not successfully created! &lt;br /&gt;&lt;br /&gt;";
  }
  ?&gt;
  </code></pre>