title: mysql creating table - PHP
body: <p>Problem getting this to work:</p>
  
  <p>I am putting this query string (as a variable):</p>
  
  <pre><code>"query" =&gt; 
              "CREATE TABLE 
                  users(
                      id INT NOT NULL AUTO_INCREMENT  PRIMARY KEY,
                      date_created DATETIME,     
                      last_active DATETIME,
                      last_logged_in DATETIME,
                      first_name VARCHAR(255),
                      last_name VARCHAR(255),
                      email VARCHAR(255), 
                      password VARCHAR(255),  
                      permissions INT,  
                      status SMALLINT
                  )"  
  </code></pre>
  
  <p>into this loop:</p>
  
  <pre><code>foreach( $queryStrings as $queryString )
  {  
      $query = Database::Query( $queryString[ "query" ] );
      if( $query )
      {
          echo "Database table " . $queryString[ "name" ] . " successfully created&lt;br /&gt;"; 
      }
      else
      {     
          echo "Database table " . $queryString[ "name" ] . " failed to create&lt;br /&gt;"; 
      }
  }
  </code></pre>
  
  <p>The Database:Query is here:</p>
  
  <pre><code>    public static function Query( $query )
      {
          $query = self::$mysqli-&gt;real_escape_string( trim( $query ) );  
  
          if ( $query = self::$mysqli-&gt;prepare($query) ) 
          {
              $query-&gt;execute();   
  
              $DatabaseQuery = new DatabaseQuery();
                  $DatabaseQuery-&gt;result = $query-&gt;get_result();       
                  $DatabaseQuery-&gt;mysql_num_rows = $query-&gt;num_rows();                 
                  $query-&gt;close();
                  return $DatabaseQuery;                   
          }          
  
          echo false;
      }
  </code></pre>
  
  <p>It fails to get past: </p>
  
  <pre><code>if ( $query = self::$mysqli-&gt;prepare($query) ) 
  </code></pre>
  
  <p>The string it is preparing is here:</p>
  
  <pre><code>CREATE TABLE \r\n users(\r\n id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,\r\n date_created DATETIME, \r\n last_active DATETIME,\r\n last_logged_in DATETIME,\r\n first_name VARCHAR(255),\r\n last_name VARCHAR(255),\r\n email VARCHAR(255), \r\n password VARCHAR(255), \r\n permissions INT, \r\n status SMALLINT\r\n )
  </code></pre>