I have the config 'prefix' => 'hq_'
,
and I created a table : hq_products(pd_id, pd_price, pd_name,pd_date)
.
In controller, I want to delete a product. I used:
$productId = (int) $this->params['url']['id'];
$this->Product->deleteAll(array('Product.pd_id' => $productId));
and received the error :
Warning (512): SQL Error: 1054: Unknown column 'Product.id' in 'field list' [CORE\cake\libs\model\datasources\dbo_source.php, line 684]
Query:
SELECT `Product`.`id` FROM `hq_products` AS `Product` WHERE `Product`.`pd_id` = 1
I also used : $this->Product->delete($productId);
same error.
Please help me.
Product.id
for the unknown field, but you're usingProduct.pd_id
in the queries? – Marc BSELECT
, but it should beDELETE
. Are you sure you pasted the correct query? – JJJ