Example #1
0
 /**
  * returns the SQL sentence needed to create a table
  *
  * @param string $dbname
  * @param string $table
  * @return string
  */
 public static function sqlCreation($dbname, $table)
 {
     $conn = DbTools::connect($dbname);
     $sql = "show create table {$table}";
     $sqlCreation = "";
     try {
         $result = $conn->query($sql);
         //$st=$result->fetch_assoc();
         if ($result) {
             $jj = $result->fetch_array();
             $sqlCreation = $jj[1];
         }
         $conn->close();
     } catch (Exception $e) {
         $conn->close();
         die("Query failed: " . $e->getMessage());
     }
     return $sqlCreation;
 }