php - Insert query not working even though it is right -
you have error in sql syntax; check manual corresponds mysql server version right syntax use near ','','','')' @ line 2
i above error when running php file.
my insert query
$updateusercanvas="insert user_canvas(cns_id,course_id,context_id,email_id,resource_id) values(".$canvasid.",".$courseid.",'".$contextid."','".$email."','".$resourseid."')";
cns_id,course_id integer datatype , context_id,email varchar , resource_id text datatype
i searched problem , tried adding mysql_real_escape_string
$updateusercanvas="insert user_canvas(cns_id,course_id,context_id,email_id,resource_id) values(".$canvasid.",".$courseid.",'".mysql_real_escape_string($contextid)."','".mysql_real_escape_string($email)."','".mysql_real_escape_string($resourseid)."')";
but still not working. dont know mistaking.any appreciated.thanks.
try this
$updateusercanvas="insert user_canvas(cns_id,course_id,context_id,email_id,resource_id) values('".$canvasid."','".$courseid."','".addslashes($contextid)."','".addslashes($email)."','".addslashes($resourseid)."')";
Comments
Post a Comment