jcjst21 Posted August 7, 2011 Share Posted August 7, 2011 Hello, I receive an error when i submit my form for processing: it says: 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 'group, Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday) VALUES ('' at line 1 i can't figure out what's wrong with my code; it looks right to me: <?php $hcTime=$_POST['scheduleTime']; $group=$_POST['groupToCall']; $sunday=$_POST['Sunday']; $monday=$_POST['Monday']; $tuesday=$_POST['Tuesday']; $wednesday=$_POST['Wednesday']; $thursday=$_POST['Thursday']; $friday=$_POST['Friday']; $saturday=$_POST['Saturday']; if(isset($_POST['scheduleTime'])) { $sql="INSERT INTO HealthCenterSchedule(time, group, Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday) VALUES ('$hcTime', '$group', '$sunday', '$monday', '$tuesday', '$wednesday', '$thursday', '$friday', '$saturday')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); echo $sql; } $result = mysql_query("SELECT * FROM HealthCenterSchedule"); } ?> Could someone take a look at this and see if I'm not seeing something. Thanks, jcjst21 Link to comment https://forums.phpfreaks.com/topic/244164-help-with-mysql-insert-into-syntax-error/ Share on other sites More sharing options...
PFMaBiSmAd Posted August 7, 2011 Share Posted August 7, 2011 group is a reserved mysql keyword and should not be used as a column name. Link to comment https://forums.phpfreaks.com/topic/244164-help-with-mysql-insert-into-syntax-error/#findComment-1253915 Share on other sites More sharing options...
jcjst21 Posted August 7, 2011 Author Share Posted August 7, 2011 Ooohhhh i'll fix that, and let you know what happens... Link to comment https://forums.phpfreaks.com/topic/244164-help-with-mysql-insert-into-syntax-error/#findComment-1253917 Share on other sites More sharing options...
jcjst21 Posted August 8, 2011 Author Share Posted August 8, 2011 that was it! Thank you so much! jcjst21 Link to comment https://forums.phpfreaks.com/topic/244164-help-with-mysql-insert-into-syntax-error/#findComment-1253921 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.