0
我做一個應用程序,顯示一些價格爲註冊人的產品。 當創建產品頁面顯示我「數據庫錯誤」 「錯誤:SQLSTATE [42S22]:列未找到:1054未知列‘Product.utype’在‘where子句’」沒有數據庫錯誤的產品控制器如何42S22
我的ProductsController是這樣的:
class ProductsController extends AppController {
public function index() {
$this->Product->recursive = 0;
$products = $this->Product->find('all');
$this->set('products', $Product);
}
/**
* view method
*
* @throws NotFoundException
* @param string $id
* @return void
*/
public function view($id = null) {
$this->Product->id = $id;
if (!$this->Product->exists()) {
throw new NotFoundException(__('Invalid Product'));
}
$this->set('products', $this->Product->read(null, $id));
}
}
和模型Product.php是這樣的:
class Product extends AppModel {
public $primaryKey = 'id_prod';
/**
* belongsTo associations
*
* @var array
*/
public $belongsTo = array(
'Occurrence' => array(
'className' => 'Occurrence',
'foreignKey' => 'occurrence_id',
'conditions' => '',
'fields' => '',
'order' => ''
),
'User' => array(
'className' => 'User',
'foreignKey' => 'user_id',
'conditions' => '',
'fields' => '',
'order' => ''
)
);
}
能幫助我,好嗎? 謝謝。