2013-12-11 101 views
-4

任何人都可以帮助我找出我做错了什么吗?SQL错误消息:

我得到当我按下提交表单上的此错误消息:

您的SQL语法错误;检查与你的MySQL服务器版本相对应的手册,在'2013-12-10','','dsffsd','dfsfsd','sfdd','sdffsd','sdfsdf','sfdsdf附近使用正确的语法”, 'DSAD' 在行8

,这是PHP代码的行8:

function renderForm($caseref, $casetype, $clienttitle, $clientforename, $clientsurname, 
$clientdob, $clienttelhome, $clienttelwork, $clienttelmob, $clientemail, 
$clientaddress1, $clientaddress2, $clientaddress3, $clientaddress4, $clientaddress5, 
$clientpostcode, $clientoccupation, $clientni, $defendanttitle, $defendantforename, 
$defendantsurname, $defendantaddress1, $defendantaddress2, $defendantaddress3, 
$defendantaddress4, $defendantaddress5, $defendantpostcode, $defendantvehiclereg, 
$defendantpolicyno, $defendantinsurername, $defendantcomments, $softtissue, $boneinjury, 
$whiplash, $injurydescription, $timeoffwork, $medicalattention, $attendedhospital, 
$hospitalname, $hospitaladdress1, $hospitaladdress2, $hospitaladdress3, 
$hospitaladdress4, $hospitaladdress5, $hospitalpostcode, $claimantposition, 
$passengernumber, $claimantseatbelt, $ownertitle, $ownerforename, $ownersurname, 
$owneraddress1, $owneraddress2, $owneraddress3, $owneraddress4, $owneraddress5, 
$ownerpostcode, $drivertitle, $driverforename, $driversurname, $driveraddress1, 
$driveraddress2, $driveraddress3, $driveraddress4, $driveraddress5, $driverpostcode, 
$clientvehiclemake, $clientvehiclemodel, $clientvehiclereg, $clientinsurername, 
$clientpolicyno, $doa, $timeaccident, $accidentlocation, $weatherconditions, 
$roadconditions, $accidentcircumstances, $policereported, $namepolice, $incidentref, 
$otherinfo, $submitdate, $error) 

查询:

INSERT INTO clients (caseref, casetype, clienttitle, clientforename, clientsurname, 
submitdate, clientdob, clienttelhome) VALUES ('$caseref', '$casetype', '$clienttitle', 
'$clientforename', '$clientsurname', '$submitdate', '$clientdob', '$clienttelhome') 
+3

感谢您告诉我们。如果你有问题,请回来问问。 – JohnFx

+2

由于这是一个SQL错误,因此如果您显示查询以及它是如何创建的,它可能会有所帮助。 –

+0

您得到的错误来自生成的SQL查询,而不是您的PHP代码。如果您可以添加查询,我们可能会提供帮助。 – andrewsi

回答

0

硬盘需要不一样多的细节来猜测,但我认为你正在利用aphostropes逃避价值观(')。这是PHP的习惯。 MySQL不会使用aphostropes转义这些值,它使用backtiks(`)或者什么都不使用。你可以改变你提供删除这些符号您的查询部分:

...

2013-12-10, NULL, dsffsd, dfsfsd, sfdd, sdffsd, sdfsdf, sfdsdf, dsad 

...

编辑:

你所著值之间的空间() 。没有空间需要。如下更改:

INSERT INTO clients (caseref, casetype, clienttitle, clientforename, clientsurname, 
submitdate, clientdob, clienttelhome) VALUES('$caseref', '$casetype', '$clienttitle', 
'$clientforename', '$clientsurname', '$submitdate', '$clientdob', '$clienttelhome') 
+0

mysql_query(“INSERT INTO clients(caseref,casetype,clienttitle,clientforename,clientsurname,submitdate,clientdob,clienttelhome) VALUES('$ caseref','$ casetype','$ clienttitle','$ clientforename','$ clientsurname ','$ submitdate','$ clientdob','$ clienttelhome')“) 或die(mysql_error()); |||这是MYSQL_Query代码||| – Danishcj

+0

请检查我的编辑。 – aksu