@@ -13,25 +13,25 @@ |
||
| 13 | 13 | |
| 14 | 14 | class DatabaseHelper { |
| 15 | 15 | |
| 16 | - public $dbConn; |
|
| 16 | + public $dbConn; |
|
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * This is a constructor; a default method that will be called automatically during class instantiation |
|
| 20 | - */ |
|
| 21 | - public function __construct($dbConnect) |
|
| 22 | - { |
|
| 23 | - $this->dbConn = $dbConnect; |
|
| 24 | - } |
|
| 18 | + /** |
|
| 19 | + * This is a constructor; a default method that will be called automatically during class instantiation |
|
| 20 | + */ |
|
| 21 | + public function __construct($dbConnect) |
|
| 22 | + { |
|
| 23 | + $this->dbConn = $dbConnect; |
|
| 24 | + } |
|
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * This method creates a particular table |
|
| 28 | - * @param tableName |
|
| 29 | - * $return boolean true or false |
|
| 30 | - */ |
|
| 26 | + /** |
|
| 27 | + * This method creates a particular table |
|
| 28 | + * @param tableName |
|
| 29 | + * $return boolean true or false |
|
| 30 | + */ |
|
| 31 | 31 | public function createTable($tableName, $conn = NULL) |
| 32 | 32 | { |
| 33 | 33 | if (is_null($conn)) { |
| 34 | - $conn = $this->dbConn; |
|
| 34 | + $conn = $this->dbConn; |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | $sql = 'CREATE TABLE IF NOT EXISTS '.$tableName.'('; |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | $sql = 'CREATE TABLE IF NOT EXISTS '.$tableName.'('; |
| 38 | - $sql.= ' id INT( 11 ) AUTO_INCREMENT PRIMARY KEY, name VARCHAR( 100 ), gender VARCHAR( 10 ), alias VARCHAR( 150 ) NOT NULL, class VARCHAR( 150 ), stack VARCHAR( 50 ) )'; |
|
| 38 | + $sql .= ' id INT( 11 ) AUTO_INCREMENT PRIMARY KEY, name VARCHAR( 100 ), gender VARCHAR( 10 ), alias VARCHAR( 150 ) NOT NULL, class VARCHAR( 150 ), stack VARCHAR( 50 ) )'; |
|
| 39 | 39 | |
| 40 | 40 | return $conn->exec($sql); |
| 41 | 41 | throw TableNotCreatedException::tableNotCreatedException("Check your database connection"); |