for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* @author Temitope Olotin <[email protected]>
* @license <https://opensource.org/license/MIT> MIT
*/
namespace Laztopaz\PotatoORM;
class DatabaseHelper
{
public $dbConn;
* This is a constructor; a default method that will be called automatically during class instantiation.
public function __construct($dbConnect)
$this->dbConn = $dbConnect;
}
* This method creates a particular table.
*
* @param tableName
* $return boolean true or false
public function createTable($tableName, $conn = null)
if (is_null($conn)) {
$conn = $this->dbConn;
$sql = 'CREATE TABLE IF NOT EXISTS '.$tableName.'(';
$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 ) )';
return $conn->exec($sql);