Hello. Here's the insert statement which I'm executing:
mysql_query("INSERT INTO CustomerEntry (ClientSalesID, ClientNameID, FName, LName, StreetNum, StreetName, Zip, Telephone, Email, GuessNumber, GuessDate, CurrVehicleYr, CurrVehicleMake, CurrVehicleModel, LastVehiclePurchase, VehicleType, CurrPayment, MostImportantNewCar, Marketing) values ('$FName', '$LName', '$StreetNum', '$StreetName', '$Zip', '$Telephone', '$Email', '$GuessNumber', '$DateOfSubmit', '$CurrVehicleYear', '$CurrVehicleMake', '$CurrVehicleModel', '$VehiclePurchase', '$CurrVehicleType', '$CurrPayment', '$MostImportantNewCar', '$Marketing')");
[Admin Edit: added some spaces to the SQL statement to allow it to wrap]
I have a connection to MySQL, because a previous query works fine. Here's the fields I have in the MySQL table, called CustomerEntry
CustomerEntryID, ClientSalesID, ClientNameID, FName, LName, StreetNum, StreetName, Zip, Telephone, Email, GuessNumber, GuessDate, CurrVehicleYr, CurrVehicleMake, CurrVehicleModel, LastVehiclePurchase, VehicleType, CurrPayment, MostImportantNewCar and Marketing
Do you see any typo? Nothing is inserted.
This INSERT query isn't working correctly; need set of eyes
Moderator: General Moderators
- redhair
- Forum Contributor
- Posts: 300
- Joined: Fri May 30, 2003 4:36 pm
- Location: 53.23N-6.57E
- Contact:
btw.....ClientSalesID, ClientNameID is not beeing added in your code
i think you should try:
[Admin Edit: Added some spaces to the SQL statement to allow it to wrap]
i left ClientSalesID emty...if you have that cell on auto increment and primary key in your database it will automaticaly add a number if you add something to the database
i think you should try:
Code: Select all
<?php
mysql_query("INSERT INTO CustomerEntry (ClientNameID, FName, LName, StreetNum, StreetName, Zip, Telephone, Email, GuessNumber, GuessDate, CurrVehicleYr, CurrVehicleMake, CurrVehicleModel, LastVehiclePurchase, VehicleType, CurrPayment, MostImportantNewCar, Marketing) values ('$ClientNameID', '$FName', '$LName', '$StreetNum', '$StreetName', '$Zip', '$Telephone', '$Email', '$GuessNumber', '$DateOfSubmit', '$CurrVehicleYear', '$CurrVehicleMake', '$CurrVehicleModel', '$VehiclePurchase', '$CurrVehicleType', '$CurrPayment', '$MostImportantNewCar', '$Marketing')");
?>i left ClientSalesID emty...if you have that cell on auto increment and primary key in your database it will automaticaly add a number if you add something to the database