|
我在我的两页上收到了这个错误,但我不明白为什么。我已经重写了代码并进行了三次检查,但我找不到任何错误。; \/ [; i' v6 n% y6 f: k
第一个是:
, C7 E' Z: @& W$ J2 j7 \ public function academics ($id,$problem_solving , $math_understanding, $cs_understanding , $math_useful , $cs_useful,$math_ava, $cs_ava, $assigment_start, $assigment_submit, $travel_time, $stress,$assigment_when, $full_part, $pair_programming, $attending_class, $attending_labs,$attending_tutorials, $extra_reading,$p_progamming, $q_cs, $q_maths, $procrastinating_assigments, $procrastinating_studying){ try{ $stmt = $this->db->prepare("UPDATE student_data SET problem_solving=:problemS,math_understanding=:math_U,cs_understanding=: cs_u,math_useful =:m,cs_useful=:cs_u,math_ava=:ma,cs_ava=:ca,assigment_start=:ass_st,assigment_submit=:assigment_submit,travel_time =:travel_time,stress=: stress,assigment_when =:assigment_when,full_part =:full_part,pair_programming=: pair_programming, attending_class=: attending_class,attending_labs=: attending_labs,attending_tutorials =:attending_tutorials,extra_reading =:extra_reading,p_progamming=: p_progamming, q_cs=: q_cs, q_maths=: q_maths,procrastinating_assigments=:procrastinating_assigments,procrastinating_studying=:procrastinating_studying WHERE user_id=:uid"); $stmt->bindparam(":uid",$id); $stmt->bindparam(":problemS",$problem_solving ); $stmt->bindparam(":math_U",$math_understanding); $stmt->bindparam(":cs_u",$cs_understanding ); $stmt->bindparam(":m",$math_useful ); $stmt->bindparam(":cs_u",$cs_useful); $stmt->bindparam(":ma",$math_ava); $stmt->bindparam(":ca",$cs_ava); $stmt->bindparam(":ass_st",$assigment_start); $stmt->bindparam(":assigment_submit",$assigment_submit); $stmt->bindparam(":travel_time",$travel_time); $stmt->bindparam(":stress",$stress); $stmt->bindparam(":assigment_when",$assigment_when); $stmt->bindparam(":full_part",$full_part )$stmt->bindparam(":pair_programming",$pair_programming); $stmt->bindparam(":attending_class",$attending_class); $stmt->bindparam(":attending_labs",$attending_labs); $stmt->bindparam(":attending_tutorials",$attending_tutorials); $stmt->bindparam(":extra_reading",$extra_reading); $stmt->bindparam(":p_progamming",$p_progamming); $stmt->bindparam(":q_cs",$q_cs); $stmt->bindparam(":q_maths",$q_maths); $stmt->bindparam(":procrastinating_assigments",$procrastinating_assigments); $stmt->bindparam(":procrastinating_studying",$procrastinating_studying); $stmt->execute()catch(PDOException $e) echo $e->getMessage()第二个是:
. w3 a; y- k7 m) Q& ^public function comps ($id,$long,$often_comp,$gaming,$research,$doc,$music,$vid,$fix,$social){ try{ $stmt = $this->db->prepare("UPDATE student_data SET long=:long,often_comp=ften ,gaming=:gaming,research=:research,doc=:doc,music=:music,vid=:vid,fix=:fix,social=:social WHERE user_id=:uid"); $stmt->bindparam(":uid",$id); $stmt->bindparam(":long",$long); $stmt->bindparam("ften",$often_comp); $stmt->bindparam(":gaming",$gaming); $stmt->bindparam(":research",$research); $stmt->bindparam(":doc",$doc); $stmt->bindparam(":music",$music); $stmt->bindparam(":vid",$vid); $stmt->bindparam(":fix",$fix); $stmt->bindparam(":social",$social); $stmt->execute()catch(PDOException $e) echo $e->getMessage();
9 u; O; z: |: a9 _( C5 ^ 解决方案: Q; n" Y3 h, o. F9 B1 M
好吧,太长了,不能发表评论(顺便说一句,对这个长没有双关语)。
3 e4 D9 n5 G+ R% @ B! P( x看到那些 不是 拼写错误(我希望他们 不是 错别字),你会发现冒号后面有很多空间。
P2 C; ?# M3 K你需要删除它们的空间,然后将其删除MySQL保留字包装tick之中LONG,或者将其重命名为保留字以外的其他名称。
4 T. G5 N1 i2 }' e) oIE: W+ D" \% H" g
SET `long`=:long,...参考:1 Z4 F( @$ l B
https://dev.mysql.com/doc/refman/5.5/zh-CN/keywords.html脚注:
! j7 m1 L9 E0 K/ B1 E) x" PTBH:因此,如果我错过了一些内容,我需要检查所有的绑定,并确保它们都匹配。/ N. [& N" X7 L& e4 c( ~
编辑:7 D8 J0 v9 C- L0 ^
``我不知道php空间,以为它像C / C 也忽略了他们,现在可以工作了。再次感谢!3 j, D0 O# Y6 N9 a, T) E& O
这不是C / C ,但是PHP,这种语言确实可以用于空格。 |
|