アプリケーションにフレームワーク CakePHP を使用しています。xampp を使用して localhost でプログラムし、今すぐ自分の Web サイトにアップロードしようとしています。ローカルホストでは問題なく動作しました。現在、この 1 つのページのみがあり、新しいサーバーでは機能しません。他のサイト (データベース接続も使用) は問題なく動作します。
この 1 つのサイトに対して、次のメッセージが表示されます。
エラー: SQLSTATE[42000]: 構文エラーまたはアクセス違反: 1064 SQL 構文にエラーがあります。1行目の「add」付近で使用する正しい構文については、MySQLサーバーのバージョンに対応するマニュアルを確認してください
SQL クエリ: 追加
関数 add() は次のようになります。
public function add() {
//$this->create();
$word_id = $this->Word->getWord_id();
$save = $this->save(array('word_id' => $word_id, 'text' => $this->getText($word_id), 'mistake' => 0));
return $save['Game']['id'];
}
localhost では、MySQL-Client-Version: mysqlnd 5.0.8-dev - 20102224 - $Revision: 310735 $ および PHP バージョン 5.3.8 を使用しました。
サーバーでは、MySQL-Client-Version: 5.1.62 および PHP バージョン 5.3.17 を使用しています。
助けてくれてありがとう!
編集:モデル「ゲーム」:
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' => 0));
return $save['Game']['id']; // Build the hangman
}
}
$this->Game をデバッグすると、出力は次のようになります。
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) 10
}
whitelist => array()
cacheSources => true
findQueryType => null
recursive => (int) 1
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
)
}