错误:SQLSTATE [42000]:语法错误或cakePHP的访问冲突
技术问答
168 人阅读
|
0 人回复
|
2023-09-12
|
我正在使用我的应用程序cakePHP框架xampp在localhost编程它,现在试着把它上传到我的网站上。localhost没有问题。现在只有一页,在新服务器上不起作用。其他站点(也使用数据库连接)可以正常工作。
: [; L* v# o: K% t本网站将显示以下消息: ^0 ]% E' S7 O9 l* ]
错误:SQLSTATE& Y0 [9 v% R% k( g- ^8 @1 P8 D% W
[42000]:语法错误或访问冲突:1064您SQL语法错误;请参见SQL句子。和你一起检查MySQL服务器版对应的手册在第一行’add’在附近使用正确的语法
4 `1 a* K. J4 KSQL查询:添加* q9 `8 L1 a, A! y( a8 \
函数add()看起来像这样。
+ s+ j m+ r) I( A' F4 bpublic function add(){ $this->create(); $word_id = $this->Word->getWord_id(); $save = $this->save(array('word_id' => $word_id,'text' => $this->getText($word_id),'mistake' => return $save['Game']['id在localhost上,我用了MySQL-Client-Version:mysqlnd 5.0.8-dev-20102224-$
, f7 O8 E, K) x* GRevision:310735 $和PHP版本5.3.8。) w/ r- P- a: w
我用在服务器上MySQL-Client-Version:5.1.62和PHP版本5.3.17。
+ Q2 [! [/ G% m$ J- _非常感谢您的帮助!1 x$ v5 r6 K; g6 q4 ?4 [
编辑:模型游戏:
% C- @2 d4 V) k: q) V; v8 ]class Game extends AppModel { public $name = 'Game'; public $belongsTo = 'Word'; public $searchedWord = public function addGame() { / Create new game $word_id = $this->Word->getWord_id(); $save = $this->save(array('word_id' => $word_id,'text' => $this->getText($word_id),'mistake' => return $save['Game']['id // Build the hangman 当我调试$ this-> Game输出为:0 ?& u& v1 o# v: d9 r( {/ x5 M
object(AppModel) useDbConfig => 'default useTable => 'games id => null data => array() schemaName => null table => 'games primaryKey => 'id validate => array() validationErrors => array() validationDomain => null name => 'Game alias => 'Game tableToModel => array games' => 'Game ) cacheQueries => false belongsTo => array() hasOne => array() hasMany => array() hasAndBelongsToMany => array() actsAs => null Behaviors => object(BehaviorCollection) modelName => 'Game defaultPriority => (int) whitelist => array() cacheSources => true findQueryType => null recursive => (int) order => null virtualFields => array() __backAssociation => array() __backInnerAssociation => array() __backOriginalAssociation => array() __backContainableAssociation => array() findMethods => array all' => true, first' => true, count' => true, neighbors' => true, list' => true, threaded' => true
5 p( d4 e- b7 ~! O. o& V3 V 解决方案: |
|
|
|
|
|