cakephp - How do a ProductController without database error 42S22 -
i app show products cost register people. when create product page show me "database error" "error: sqlstate[42s22]: column not found: 1054 unknown column 'product.utype' in 'where clause'"
my productscontroller this:
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)); } } and model product.php this:
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' => '' ) ); } can help me, please? give thanks you.
per explicit error:
error: sqlstate[42s22]: column not found: 1054 unknown column 'product.utype' in 'where clause'"
your code looking colum 'utype' in products table (which apparently doesn't exist). if you're not sure code telling that, project-wide search "utype" , update right field name.
cakephp
No comments:
Post a Comment