Jump to content

SQL syntax error


jeff5656

Recommended Posts

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 'lines, code, allergy, todo, signoff_status) VALUES('','109', 'test', '12345',' at line 1

 

 

With this code:  I can't figure out where th error is.

<?php require('secure.php'); 


// include the config file with the needed variables

include ("connectdb.php");

// grab the variables from the form
$rm_loc = $_POST['rm_loc'];
$patient = $_POST['patient'];
$mrn = $_POST['mrn'];
$attg = $_POST['attg'];
$rcf_date = $_POST['rcf_date'];
$newdate = date("Y-m-d", strtotime($_POST['rcf_date']));
$dx = $_POST['dx'];
$pmhx = $_POST['pmhx'];
$diet = $_POST['diet'];
$meds = $_POST['meds'];
$sed = $_POST['sed'];
$ivf = $_POST['ivf'];
$abx = $_POST['abx'];
$cx = $_POST['cx'];
$prophylaxis = $_POST['prophylaxis'];
$vent = $_POST['vent'];
$lines = $_POST['lines'];
$code = $_POST['code'];
$allergy = $_POST['allergy'];
$todo = $_POST['todo'];
// insert the data into the database

echo $id_incr;
echo "<br>";

$query = "INSERT INTO icu (id_incr, rm_loc, patient, mrn, attg, rcf_date, rcf_date2, dx, pmhx, diet, meds, sed, ivf, abx, cx, prophylaxis, vent, lines, code, allergy, todo, signoff_status)

VALUES('$id_incr','$rm_loc', '$patient', '$mrn', '$attg', '$rcf_date', '$newdate', '$dx', '$pmhx', '$diet', '$meds', '$sed', '$ivf', '$abx', '$cx', '$prophylaxis', '$vent', '$lines', '$code', '$allergy', '$todo', 'a')";

mysql_query($query) or die(mysql_error());

echo "Patient added to list";
header("Location: displayactive.php");
?>

Link to comment
https://forums.phpfreaks.com/topic/126814-sql-syntax-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.