我想做一個腳本,將一個表的數據庫('alphacrm'),已經被創建。我的錯誤是,最接近底部的回聲線不會顯示,並沒有表被創建到我的數據庫。我已經證實$ dbSuccess是真實的,不知道我在哪裏出錯了。我確實試圖看看它是否正確連接,但這似乎不是問題。如果你發現我的錯誤,將不勝感激!PHP/mysql錯誤
if ($dbSuccess) {
$createCoyTable_SQL = "CREATE TABLE alphacrm.tCompany (";
$createCoyTable_SQL .= "ID INT(11) NOT NULL AUTO_INCREMENT PRIMARY ";
$createCoyTable_SQL .= "preName VARCHAR(50) , ";
$createCoyTable_SQL .= "Name VARCHAR(250) NOT NULL, ";
$createCoyTable_SQL .= "RegType VARCHAR(50) NULL, ";
$createCoyTable_SQL .= "SreetA VARCHAR(150) NULL, ";
$createCoyTable_SQL .= "SreetB VARCHAR(150) NULL, ";
$createCoyTable_SQL .= "SreetC VARCHAR(150) NULL, ";
$createCoyTable_SQL .= "Town VARCHAR(150) NULL, ";
$createCoyTable_SQL .= "County VARCHAR(150) NULL, ";
$createCoyTable_SQL .= "Postcode VARCHAR(150) NULL, ";
$createCoyTable_SQL .= "COUNTRY VARCHAR(250) NOT NULL ";
$createCoyTable_SQL .= ")";
if (mysql_query($createCoyTable_SQL)) {
echo "Creation of TABLE tCompany -- Succesful <br />";
}
$createPersonTable_SQL = "CREATE TABLE alphacrm.tPerson (";
$createPersonTable_SQL .= "ID INT(11) NOT NULL AUTO_INCREMENT PRIMARY ";
$createPersonTable_SQL .= "Salutation VARCHAR(20) , ";
$createPersonTable_SQL .= "FirstName VARCHAR(50) , ";
$createPersonTable_SQL .= "LastName VARCHAR(50) NOT NULL, ";
$createPersonTable_SQL .= "CompanyID VARCHAR(11) NOT NULL ";
$createPersonTable_SQL .= ")";
if (mysql_query($createPersonTable_SQL)) {
echo "Creation of tPerson table was succesful <br />";
}
}
如果您遇到錯誤,最好是說它是什麼 – rjdown
*經典,不使用* => ['else {http://php.net/manual/en/function.mysql-error.php} '](http://php.net/manual/en/function.mysql-error.php) –
*「我的錯誤是靠近底部的回聲線不會顯示,並且沒有表格創建到我的數據庫。 「*見評論#2。 *我認爲你忽略了*。是的。 –