ryandenkie
08-23-2006, 10:56 AM
i keep getting couldn;t execute query when i wish to add things to my database
below is my code
can some one point out the mistake for me thank you
<head>
<title>Hello!</title>
</head>
<body>
<?php
$host="mysql153.secureserver.net";
$user="carcatalog";
$password="";
$database = "carcatalog";
$connection = mysql_connect($host,$user,$password)
OR DIE ("Unable to connect to database! Please try again later.");
$db= mysql_select_db("$database",$connection)
or die ("Couldn't connect to database");
$query= "INSERT INTO Car ( Carplate no, Password, Your Name, Your Contact No, Your Email Address, Car Model, Car Registration Date, Engine Capacity, Transmission, Asking Price, Mileage, Fuel Type, Vehicle features, Accessories, Description,COE, COE Expiry Date, OMV,PARF,Number of Owners, Type of Vehicle )
VALUES ('$Carplate no', '$Password', '$Your Name', '$Your Contact No', '$Your Email Address', '$Car Model', '$Car Registration Date', '$Engine Capacity', '$Transmission', '$Asking Price', '$Mileage', '$Fuel Type', '$Vehicle features', '$Accessories', '$Description','$COE', '$COE Expiry Date', '$OMV','$PARF','$Number of Owners', '$Type of Vehicle')";
$result= mysql_query($query)
or die ("Couldn't execute query");
?>
</body>
</html>
below is my code
can some one point out the mistake for me thank you
<head>
<title>Hello!</title>
</head>
<body>
<?php
$host="mysql153.secureserver.net";
$user="carcatalog";
$password="";
$database = "carcatalog";
$connection = mysql_connect($host,$user,$password)
OR DIE ("Unable to connect to database! Please try again later.");
$db= mysql_select_db("$database",$connection)
or die ("Couldn't connect to database");
$query= "INSERT INTO Car ( Carplate no, Password, Your Name, Your Contact No, Your Email Address, Car Model, Car Registration Date, Engine Capacity, Transmission, Asking Price, Mileage, Fuel Type, Vehicle features, Accessories, Description,COE, COE Expiry Date, OMV,PARF,Number of Owners, Type of Vehicle )
VALUES ('$Carplate no', '$Password', '$Your Name', '$Your Contact No', '$Your Email Address', '$Car Model', '$Car Registration Date', '$Engine Capacity', '$Transmission', '$Asking Price', '$Mileage', '$Fuel Type', '$Vehicle features', '$Accessories', '$Description','$COE', '$COE Expiry Date', '$OMV','$PARF','$Number of Owners', '$Type of Vehicle')";
$result= mysql_query($query)
or die ("Couldn't execute query");
?>
</body>
</html>