jeff5656 Posted February 11, 2010 Share Posted February 11, 2010 I get 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 'leave) VALUES('','', '', '', '','2010-02-11', 'Resolution of indication','y',' at line 1 for this code. Any ideas? I don't see where the syntx error is. $pt_id = mysql_real_escape_string($_POST['pt_id']); $rm_loc_pre = $_POST['rm_loc']; $rm_loc = ereg_replace("[^A-Za-z0-9]", "", $rm_loc_pre); $patient = mysql_real_escape_string($_POST['patient']); $mrn_pre = $_POST['mrn']; $mrn = ereg_replace("[^A-Za-z0-9]", "", $mrn_pre); $remove_date = date("Y-m-d", strtotime($_POST['remove_date'])); $remove_reason = mysql_real_escape_string($_POST['remove_reason']); $suture = mysql_real_escape_string($_POST['suture']); $leave = mysql_real_escape_string($_POST['leave']); $query = "INSERT INTO clines (id, pt_id, patient, rm_loc, mrn, remove_date, remove_reason, suture, leave) VALUES('','$pt_id', '$patient', '$rm_loc', '$mrn','$remove_date', '$remove_reason','$suture', '$leave')"; mysql_query($query) or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/191824-syntax-error/ Share on other sites More sharing options...
premiso Posted February 11, 2010 Share Posted February 11, 2010 Leave is a reserved word in MySQL, either encase it in backticks (`) or rename the column (preferred). http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html For a list of reserved words in MySQL. Link to comment https://forums.phpfreaks.com/topic/191824-syntax-error/#findComment-1011049 Share on other sites More sharing options...
jeff5656 Posted February 11, 2010 Author Share Posted February 11, 2010 ahhh. Thanks! Link to comment https://forums.phpfreaks.com/topic/191824-syntax-error/#findComment-1011050 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.