我是 cakephp 的新手。我正在尝试搜索 mysql 表。我想使用嵌套查询。
class TableController extends AppController{
.
.
public function show(){
$this->set('discouns', $this->DiscounsController->query("SELECT * FROM discoun as Discoun WHERE gcil_id = 1"));//(SELECT id FROM gcils WHERE genre = 'Shoes' AND company_name = 'Adidas')"));
}
} 错误:
Error: Call to a member function query() on a non-object
我也试过
public function show(){
$this->DiscounsController->query("SELECT * FROM count as Count WHERE ctr_id = (SELECT id FROM ctrs WHERE genre = 'Shoes' AND company_name = 'Adidas')");
}
错误:
Error: Call to a member function query() on a non-object
文件:C:\xampp\htdocs\cakephppro\myapp\Controller\CountsController.php
请帮忙。过去几个小时我一直在尝试这个。:/