Hi im attempting to copy a php code and get it to work with a script im trying to create and i have come across the error below can anyone tell me whats going off any help would be much appreicated x
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 'to = "", meettype = "", county = "", cnumber = "", fee ' at line 2
here is my insert into database line
$query = 'insert into booking set Firstname = "'.$Firstname.'", address1 = "'.$address1.'", days = "' .$days.'", months = "'.$months.'", bookingtime = "'.$bookingtime.'", address2 = "'.$address2.'", lastname = "' .$lastname.'", cdays = "' .$cdays. '", cmonths = "' .$cmonths. '", duration = "' .$duration. '", datefrom = "' .$datefrom. '", to = "' .$to. '", meettype = "' .$meettype. '", county = "' .$county. '", cnumber = "' .$cnumber. '", fee = "' .$fee. '", pcode = "' .$pcode. '", comments = "' .$comments. '", user_id = ' . $userid ;
$insert = mysql_query ( $query ) or die(mysql_error()) ;
if($insert)
{
//echo "added" ;
header("location: confirm.php");
exit;
}
and heres the database table
CREATE TABLE IF NOT EXISTS `booking` (
`id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`Firstname` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`days` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`months` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`lastname` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`bookingtime` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`address2` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`cdays` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`cmonths` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`address1` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`town` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`cdate` date NOT NULL,
`datefrom` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`date` date NOT NULL,
`to` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`duration` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`meettype` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`county` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`fee` varchar(10) COLLATE utf8_unicode_ci NOT NULL,
`pcode` varchar(10) COLLATE utf8_unicode_ci NOT NULL,
`comments` text COLLATE utf8_unicode_ci NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;