2012-03-19 34 views
1

在我的dbsql文件中,我有兩個CREATE TABLES第一個作品,並且與插入值相關的php也起作用。MySQL表'dbsql.cars'不存在?

無論如何,第二個表不工作,任何幫助是極大的讚賞,我會把CREAT TABLE語句,然後PHP相關的..

CREATE TABLE `Cars` (
    `CarId` bigint(20) NOT NULL auto_increment, 
    `date` date NOT NULL default '0000-00-00', 
    `uploader` varchar(200) collate latin1_general_ci NOT NULL REFERENCES users(user_name), 
    `DVLAMake` varchar(200) collate latin1_general_ci NOT NULL default '', 
    `DVLAModel` varchar(200) collate latin1_general_ci NOT NULL default '', 
    `BodyStyle` varchar(200) collate latin1_general_ci NOT NULL default '', 
    `EngineSize` varchar(100) collate latin1_general_ci NOT NULL default '', 
    `Year` varchar(200) collate latin1_general_ci NOT NULL default '', 
    `Transmission` varchar(10) collate latin1_general_ci NOT NULL default '', 
    `FuelType` varchar(10) collate latin1_general_ci NOT NULL default '', 
    `CurrColour` varchar(50) collate latin1_general_ci NOT NULL default '', 
    `NoOfDoors` varchar(10) collate latin1_general_ci NOT NULL default '', 
    `SeatingCap` varchar(10) collate latin1_general_ci NOT NULL default '', 
    `Length` varchar(10) collate latin1_general_ci NOT NULL default '', 
    `Width` varchar(10) collate latin1_general_ci NOT NULL default '', 
    `Height` varchar(10) collate latin1_general_ci NOT NULL default '', 
    `CombEngCap` varchar(10) collate latin1_general_ci NOT NULL default '', 
    `DriveType` varchar(10) collate latin1_general_ci NOT NULL default '', 
    `MaxTorque` varchar(10) collate latin1_general_ci default '', 
    `MaxPower` varchar(10) collate latin1_general_ci default '', 
    `FuelConsumpURB` varchar(10) collate latin1_general_ci default '', 
    `FuelConsumpCOMB` varchar(10) collate latin1_general_ci default '', 
    `MaxSpeed` varchar(10) collate latin1_general_ci default '', 
    `Acceleration` varchar(10) collate latin1_general_ci default '', 
    `WeightKG` varchar(10) collate latin1_general_ci default '', 
    `NCAPRating` varchar(10) collate latin1_general_ci default '', 
    `SecRemCentLock` ENUM('T','F') NOT NULL default 'F', 
    `SecCentLock` ENUM('T','F') NOT NULL default 'F', 
    `SecAlarm` ENUM('T','F') NOT NULL default 'F', 
    `SecImmob` ENUM('T','F') NOT NULL default 'F', 
    `AudioEquip` ENUM('T','F') NOT NULL default 'F', 
    `ExtPowerAssSteer` ENUM('T','F') NOT NULL default 'F', 
    `ExtAssBreak` ENUM('T','F') NOT NULL default 'F', 
    `ExtElecWindows` ENUM('T','F') NOT NULL default 'F', 
    `ExtAirbags` ENUM('T','F') NOT NULL default 'F', 
    `ElecMirrors` ENUM('T','F') NOT NULL default 'F', 
    `ElecHeatedMir` ENUM('T','F') NOT NULL default 'F', 
    `IncWarranty` ENUM('T','F') NOT NULL default 'F', 
    `IncSerBook` ENUM('T','F') NOT NULL default 'F', 
    `IncMOT` ENUM('T','F') NOT NULL default 'F', 
    `IncPXConsid` ENUM('T','F') NOT NULL default 'F', 
    `CurrColour` varchar(50) collate latin1_general_ci NOT NULL default '', 
    `CarImage` varchar(50) collate latin1_general_ci NOT NULL default '', 

    PRIMARY KEY (`CarId`), 
    FULLTEXT KEY `Car_search` (`DVLAMake`,`DVLAModel`,`BodyStyle`,`CurrColour`) 

這裏是PHP:我的避風港因爲它在最後一條線上死去,所以沒有插入其餘部分...

<?php 
include 'dbc.php'; 


$path = "uploads/"; 

$path = $path . basename($_FILES['imageUpload']['name']); 


/* mysql_connect("your.hostaddress.com", "username", "password") or die(mysql_error()) ; 
mysql_select_db("Database_Name") or die(mysql_error()) ; 

*/ 
//Writes the information to the database 



$sql_insert = "INSERT into `Cars` 
      (`CarImage`) 
      VALUES 
      ('$path') 
      "; 

mysql_query($sql_insert,$link) or die("Insertion Failed:" . mysql_error()); 

... ?> 
+0

的兩個條目dbc.php具有所有連接信息,所以忽略它。因爲用戶表來自同一個系統,所以我正在尋找或可能的語法錯誤與我的表.. – JonE 2012-03-19 11:28:43

回答

2

您的創建語句是錯誤的。
你在你的表使用相同的列名兩次:CurrColour

+0

只需注意,因爲我發佈它...所有排序,謝謝一堆。 – JonE 2012-03-19 11:35:38

0

重複的列CurrColumn那麼你錯過了)在聲明

0

的盡頭,您擁有以下列

`CurrColour` varchar(50) collate latin1_general_ci NOT NULL default '',