Jump to content

[SOLVED] error in syntax help


samoht

Recommended Posts

hello,

 

I am receiving this error:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Kingston,Flintwood,PA,19082,213-209-9908,'A',date('YmdHis'),date('YmdHis'))' at line 2

 

When filling out a form. Here is the function that inserts the form info into my table

 

<?php
		// save ship address
			$sql = "INSERT INTO clientaddresses(Name, Address1, City, State, Zip, Phone, FlagStatus, DateStatus, DateCreated)
					VALUES ($txtShippingLastName,$txtShippingAddress1,$txtShippingCity,$txtShippingState,$txtShippingPostalCode,$txtShippingPhone,'A',date('YmdHis'),date('YmdHis'))";
			$result = dbQuery($sql);					

			$_SESSION['ShipAddressId'] = $ShipAddressId = dbInsertId();

 

Any Ideas what's wrong with my insert??

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/73571-solved-error-in-syntax-help/
Share on other sites

lack of quotes

$sql = "INSERT INTO clientaddresses(Name, Address1, City, State, Zip, Phone, FlagStatus, DateStatus, DateCreated)
					VALUES ('$txtShippingLastName','$txtShippingAddress1','$txtShippingCity','$txtShippingState','$txtShippingPostalCode','$txtShippingPhone','A',date('YmdHis'),date('YmdHis'))";

 

also check the date field

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.