Cakephp SQL错误1064 [英] Cakephp SQL Error 1064

查看:149
本文介绍了Cakephp SQL错误1064的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我查看申请控制器的索引页时,我收到以下错误。这已被烘焙...我不知道这是什么意思,虽然我怀疑这与表名称不是复数在SQL中的表名称是遵循蛋糕的命名约定的任何想法家伙? / p>

  SELECT`Petition`.`random_string`,`Petition`.`diary_number`,`Petition`.`group`,信访` `.`created`,`Petition`.`modified`,`Petition`.`petitioner_type`,`Petition`.`signed`,`Petition`.`project_desc`,`Petition`.`amount_suggested`,`Petition`。 `amount_accepted`,`Petition`.`project_type`,`Petition`.`project_decision`,`Petition`.`evaluation`,`Petition`.`admin_comments`,`Petition`.`commentator_comments` ,` Petition`.`q1_petitioner `,`Petition`.`q1_partners`,`Petition`.`q1_regcode`,`Petition`.`q1_responsible`,`Petition`.`q1_position`,`Petition`.`q1_address`,`Petition`.`q1_zipcode`, `Petition`.`q1_city`,`Petition`.`q1_phone`,`Petition`.`q1_gsm`,`Petition`.`q1_email`,`Petition`.`q2_project_name`,`Petition`.`q2_target_group`,信访` '.`q2_project_goal`,`Petition`.`q2_newones`,`Petition`.`q2_newgroups`,`Petition`.`q2_organizers`,`Petition`.`q2_donations`,`Petition`.`q2_type`,`Petition`。 `q3_amount`,`Petition`.`q3_purpose`,`Petition`.`q3_account_number`,`Petition`.`q3_receiver`,`Petition`.`q4_sports`,`Petition`.`q4_participates`,`Petition`.`q4_places `,`Petition`.`q4_schedule`,`Petition`.`q4_marketing`,`Petition`.`q4_directors`,`Petition`.`q4_monitoring`,`Petition`.`q4_support`,`Petition`.`q4_collaboration`, `Petition`.`q5_costs`,`Petition`.`q5_costs_desc`,`Petition`.`q5_income`,`Petition`.`q5_income_desc`,`Petition`.`q5_invisible`,`Petition`.`s1_question1`,`Petition `.`s1_question2`,`Petition`.`s1_question3`,`Petition`.`s1_question4`,`Petition`.`s1_question5`,s1_question。,Petition`.`s2_question1`,`Petition`.`s2_question2`, Petition`.`s2_question_3`,`Petition`.`s3_question1`,s3_question2。,Petition`.`s4_question1`,`Petition`.`s4_question2`,`Petition`.`s5_question1`,s5_question2。 FROM` petitions` AS` Petition` WHERE 1 = 1 LIMIT 20 1064:你的SQL语法有一个错误;检查对应于你的MySQL服务器版本使用附近'`Petition`.`s2_question1`,`Petition`.`s2_question2`,`Petition`.`s2_question_3'在行1 0 
正确的语法手册


解决方案

嗯,是的,如果表名是请愿书则SQL代码,试图从名为Petition的表中选择值将无法工作。我对Cakephp约定的理解是,它想要所有的表都是小写的,所以也许这是抛弃它的拐杖?请参阅: http://book.cakephp.org/view/1478/Inflector


I'm getting below error when I view the index page of my petitions controller. This has been just baked...I'm not sure what this means although I suspect that this is related to table name not being plural in SQL as the table name is Petitions adhering to cake's naming conventions... Any ideas guys?

 SELECT `Petition`.`random_string`, `Petition`.`diary_number`, `Petition`.`group`, `Petition`.`created`, `Petition`.`modified`, `Petition`.`petitioner_type`, `Petition`.`signed`, `Petition`.`project_desc`, `Petition`.`amount_suggested`, `Petition`.`amount_accepted`, `Petition`.`project_type`, `Petition`.`project_decision`, `Petition`.`evaluation`, `Petition`.`admin_comments`, `Petition`.`commentator_comments`, `Petition`.`q1_petitioner`, `Petition`.`q1_partners`, `Petition`.`q1_regcode`, `Petition`.`q1_responsible`, `Petition`.`q1_position`, `Petition`.`q1_address`, `Petition`.`q1_zipcode`, `Petition`.`q1_city`, `Petition`.`q1_phone`, `Petition`.`q1_gsm`, `Petition`.`q1_email`, `Petition`.`q2_project_name`, `Petition`.`q2_target_group`, `Petition`.`q2_project_goal`, `Petition`.`q2_newones`, `Petition`.`q2_newgroups`, `Petition`.`q2_organizers`, `Petition`.`q2_donations`, `Petition`.`q2_type`, `Petition`.`q3_amount`, `Petition`.`q3_purpose`, `Petition`.`q3_account_number`, `Petition`.`q3_receiver`, `Petition`.`q4_sports`, `Petition`.`q4_participates`, `Petition`.`q4_places`, `Petition`.`q4_schedule`, `Petition`.`q4_marketing`, `Petition`.`q4_directors`, `Petition`.`q4_monitoring`, `Petition`.`q4_support`, `Petition`.`q4_collaboration`, `Petition`.`q5_costs`, `Petition`.`q5_costs_desc`, `Petition`.`q5_income`, `Petition`.`q5_income_desc`, `Petition`.`q5_invisible`, `Petition`.`s1_question1`, `Petition`.`s1_question2`, `Petition`.`s1_question3`, `Petition`.`s1_question4`, `Petition`.`s1_question5`, s1_question., `Petition`.`s2_question1`, `Petition`.`s2_question2`, `Petition`.`s2_question_3`, `Petition`.`s3_question1`, s3_question2., `Petition`.`s4_question1`, `Petition`.`s4_question2`, `Petition`.`s5_question1`, s5_question2. FROM `petitions` AS `Petition` WHERE 1 = 1 LIMIT 20   1064: 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 ' `Petition`.`s2_question1`, `Petition`.`s2_question2`, `Petition`.`s2_question_3' at line 1            0

解决方案

Well, yes, if the table name is Petitions then SQL code that attempts to select values from a table named Petition, is not going to work. My understanding of Cakephp conventions is that it wants all tables to be be lowercase, so perhaps this is throwing off its inflector? See: http://book.cakephp.org/view/1478/Inflector.

这篇关于Cakephp SQL错误1064的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆