Eggzorcist Posted August 18, 2009 Share Posted August 18, 2009 I'm not sure what's causing this, but I'm getting 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 'JPFoster','Club name ID' ,Tester', '08/06/2009', 'Thursday, 6 August, 2009', '22' at line 3 Here's my query "INSERT INTO events (user, clubname, name, fromslashes, fromdisplay, fromtime, toslashes, todisplay, totime, quickdescription, pagedescription, status) VALUES (''".$_GET['USER']."','".$_GET['clubname']."' ,".$data['eventTitle']."', '".$data['from1']."', '".$data['from2']."', '".$data['fromtime']."', '".$data['to1']."', '".$data['to2']."', '".$data['totime']."', '".$data['quickDesc']."', '".$data['description']."', '".$status."')" Quote Link to comment Share on other sites More sharing options...
kickstart Posted August 18, 2009 Share Posted August 18, 2009 Hi You have an extra quote:- "INSERT INTO events (user, clubname, name, fromslashes, fromdisplay, fromtime, toslashes, todisplay, totime, quickdescription, pagedescription, status) VALUES (''".$_GET['USER']."','".$_GET['clubname']."' ,".$data['eventTitle']."', '".$data['from1']."', '".$data['from2']."', '".$data['fromtime']."', '".$data['to1']."', '".$data['to2']."', '".$data['totime']."', '".$data['quickDesc']."', '".$data['description']."', '".$status."')" All the best Keith Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted August 18, 2009 Share Posted August 18, 2009 And this is at least the second thread concerning a syntax problem with quotes in your query. Using the "','".$variable."','" syntax is extremely error prone and difficult to see syntax errors in (otherwise you could probably have found them yourself.) I recommend using the least number of transitions/different elements in a string - "INSERT INTO events (user, clubname, name, fromslashes, fromdisplay, fromtime, toslashes, todisplay, totime, quickdescription, pagedescription, status) VALUES ('{$_GET['USER']}','{$_GET['clubname']}','{$data['eventTitle']}','{$data['from1']}', '{$data['from2']}', '{$data['fromtime']}', '{$data['to1']}', '{$data['to2']}', '{$data['totime']}', '{$data['quickDesc']}', '{$data['description']}', '{$status}')" And in going through that you left out a single-quote on one of the other values. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.