私はコントローラ内でこのクエリを持っています。これは、データベース内の単純な挿入データです。cakephpのクエリが機能しません
$this->User->query('INSERT INTO users(CF,phone,username,email,city,firstname,lastname,active,group_id) VALUES ('$CF','$phone','$username','$email','$city','$name','$name','$active','$group_id')');
そして、これがモデルである:
<?php
App::uses('AppModel', 'Model');
/**
* User Model
*
* @property Group $Group
* @property User $ParentUser
* @property User $ChildUser
* @property Facility $Facility
* @property ServiceCategory $ServiceCategory
*/
class User extends AppModel {
/**
* Display field
*
* @var string
*/
public $displayField = 'name';
//The Associations below have been created with all possible keys, those that are not needed can be removed
/**
* belongsTo associations
*
* @var array
*/
public $virtualFields = array(
// 'name' => 'CONCAT(User.lastname, " ", User.firstname)'
'name' => 'CONCAT(lastname, " ", firstname)'
);
public $belongsTo = array(
'Group' => array(
'className' => 'Group',
'foreignKey' => 'group_id',
'conditions' => '',
'fields' => '',
'order' => ''
), 'Gender'
);
public $hasMany = array('Bid');
/**
* hasAndBelongsToMany associations
*
* @var array
*/
public $hasAndBelongsToMany = array(
'Facility' => array(
'className' => 'Facility',
'joinTable' => 'facilities_users',
'foreignKey' => 'user_id',
'associationForeignKey' => 'facility_id',
'unique' => 'keepExisting',
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'finderQuery' => '',
),
'ServiceCategory' => array(
'className' => 'ServiceCategory',
'joinTable' => 'service_categories_users',
'foreignKey' => 'user_id',
'associationForeignKey' => 'service_category_id',
'unique' => 'keepExisting',
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'finderQuery' => '',
)
);
}
しかし、答えは空白のページです。 cakephpのバージョンは2です。誰も助けることができますか?あなたが私が間違っている場所を私に説明することができれば、私は同じ間違いを繰り返さないでしょう。