了什么happenned是你的“CREATE TABLE”将失败。
获取到对于每一个MySQL的查询后,检查错误(在你的代码)的习惯:有一些时候,你可以忽略错误,但它是罕见的。所以程序alonghte线:
Create query: $sql =
Set parameters: $aParams = (or bind paramters)
Execute query
If errors
If debug: Show error and query
If live: Log error and query
我不会放弃的解决方案是代码,如一个问题,你按照教程是它使用mysql_(),它们将在短期内贬值的功能。您应该使用PDO (PHP Database Objects)或mysqli()函数,否则您的代码将无法在几个发布时间内运行。
使用PDO,您可以设置错误处理以使用异常,并且您可以将每个调用都包装在try {} catch {}中,这使捕捉和报告错误的习惯变得非常容易。
$sql = 'CREATE TABLE....';
$aParams = array(
':param_name' => $param_value,
':param_name2' => $param_value2
);
try {
$stmnt = $db->prepare($sql);
$stmnt->execute($aParams);
$stmnt = null;
} catch (Exception $e) {
// Error log here; $e contins line of error and the actual error, you have $sql and $aParams
LogDBError($e, $sql, $aParams);
}