this gives me an ‘invalid syntax’ error. what’s so invalid about it?
$companyName = 'big company';
$address1 = 'big bay #8';
$address2 = 'some big warehouse';
$city = 'big city';
$province = 'AB';
$postalCode = 'T1T0N0';
$phone = '0123456789';
$email2 = 'bigKahuna@bigKahuna.edu';
$query = "INSERT INTO clients ";
$query .= "(companyName, address1, address2, city, province, postalCode, phone, email) ";
$query .= "VALUES (". $companyName.",".$address1.",".$address2.",".$city.",".$postalCode.",".$phone.",".$email2.")";
print ($query . "<br><br>");
$result = mysql_query($query, $connexion);
if ($result)
{
// Success!
echo "Fabulous! check the DB, we did it! :D<br>";
} else {
// Fail!
echo"CRAAAAAPP! something went wrong. FIX IT! :P<br>";
echo mysql_error();
}
i’ve triple checked the table and it’s basically all VARCHAR(50), the names are correct and the sequence is correct (not that bad sequence would break it…).
What am I missing? … and NO, connexion is NOT misspelled…
You have a bunch of string variables that should be enclosed in single quotes (and properly escaped).