jeff5656 Posted September 8, 2009 Share Posted September 8, 2009 I get this error: Invalid query: 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 '], mrn = '0',your_name = 'Michael Mendez', dx = 'PNA w/ background Asbestos Expo' at line 1 with this: <?php session_start(); if($_SESSION['xray']!='y'){ $_SESSION['loc']='../xray/displayactive.php'; header("location:../telephone/main_login.php"); } include "connectdb.php"; $mrn_pre = $_POST['mrn']; $mrn = ereg_replace("[^A-Za-z0-9]", "", $mrn_pre); $subm = $_POST['subm']; $patient = mysql_real_escape_string($_POST['patient']); $mrn = mysql_real_escape_string($_POST['mrn']); $your_name = mysql_real_escape_string($_POST['your_name']); $dx = mysql_real_escape_string($_POST['dx']); $hx = mysql_real_escape_string($_POST['hx']); $show_xr = mysql_real_escape_string($_POST['show_xr']); $show_ct = mysql_real_escape_string($_POST['show_ct']); $path = mysql_real_escape_string($_POST['path']); $show_path = mysql_real_escape_string($_POST['show_path']); $rcf_date = mysql_real_escape_string($_POST['rcf_date']); $conf_date = mysql_real_escape_string($_POST['conf_date']); $teach = mysql_real_escape_string($_POST['teach']); $comments = mysql_real_escape_string($_POST['comments']); $fellow = mysql_real_escape_string($_POST['fellow']); $signoff_status = mysql_real_escape_string($_POST['signoff_status']); $sql = "UPDATE xrayconf SET patient_name = '$patient_name'], mrn = '$mrn',your_name = '$your_name', dx = '$dx', hx = '$hx', show_xr = '$show_xr', show_ct = '$show_ct',path = '$path',show_path = '$show_path',rcf_date = '$rcf_date', conf_date = '$conf_date' teach = '$teach', comments = '$comments', fellow = '$fellow', signoff_status = '$signoff_status' WHERE id_incr = ".$_POST['id_incr'].""; if (isset($sql) && !empty($sql)) { $result = mysql_query($sql) or die ("Invalid query: " . mysql_error()); } if ($subm == 'y') { header("Location: displaypotential.php"); } elseif ($subm == 'old') { header("Location: displayold.php"); } else { header("Location: displayactive.php"); } ?> Link to comment https://forums.phpfreaks.com/topic/173608-solved-invalid-query-error-in-sql-syntax/ Share on other sites More sharing options...
Kryllster Posted September 8, 2009 Share Posted September 8, 2009 I may be wrong but is the ] where it says $patient_name supposed to be there? I'd also go thru the rest of it to be sure it all matches what your supposed to have in each place. Link to comment https://forums.phpfreaks.com/topic/173608-solved-invalid-query-error-in-sql-syntax/#findComment-915112 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.