我有这个 php 代码,没有抛出错误,但是数据没有插入到表中,也没有创建表,你能告诉我哪里出错了吗?
提前干杯:)
DB_Functions.php
private $db;
// constructor
function __construct() {
require_once 'DB_Connect.php';
// connecting to database
$this->db = new DB_Connect();
$this->db->connect();
}
// destructor
function __destruct() {
}
public function storeUnit($email, $units, $maint, $attent, $done) {
$con = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD) or die (mysql_error());
mysql_select_db(DB_DATABASE, $con);
$format = 'Y-m-d G:i:s';
$date = date($format);
$result = mysql_query("CREATE TABLE IF NOT EXISTS $email( Units VARCHAR(10), Finish VARCHAR(20), Attent VARCHAR(200), Maint VARCHAR(200), created_at VARCHAR(30))",$con);
$result = mysql_query("INSERT INTO '$email'(Units, Finish, Attent, Maint, created_at) VALUES('$units', '$done', '$attent', '$maint', '$date')");
return true;
}