Jump to content

syntax error


jeff5656

Recommended Posts

I have this error, but an't seem to find where it is:

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 ' sex, comments, init_date, conf_date, signoff_status) VALUES('','bobby','', '' at line 1

 

if ($_POST['conf_date']==''){ $conf_date ='2030-01-01';  }
else { $conf_date = date("Y-m-d", strtotime($_POST['conf_date'])); }

$tx = mysql_real_escape_string($_POST['tx']);
$primpulm = mysql_real_escape_string($_POST['primpulm']);
$rheum = mysql_real_escape_string($_POST['rheum']);
$dx = mysql_real_escape_string($_POST['dx']);
$bx = mysql_real_escape_string($_POST['bx']);
$bx_date = date("Y-m-d", strtotime($_POST['bx_date']));

$comments = mysql_real_escape_string($_POST['comments']);


//add to main table
$query = "INSERT INTO ild (id_incr, lname, fname, mrn, physician, primpulm, rheum, dx, bx, bx_date, $datedump, sex, comments, init_date, conf_date, signoff_status)

VALUES('$id_incr','$lname','$fname', '$mrn', '$physician','$primpulm','$rheum', '$dx','$bx', '$bx_date','$dob','$sex', '$comments', '$init_date', '$conf_date', 'a')";

mysql_query($query) or die(mysql_error());
$pt_id =  mysql_insert_id();

 

When I echo $query, it does indeed echo back all the values, before giving me the above error.

Link to comment
https://forums.phpfreaks.com/topic/184406-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.