Good evening, how do I get a specific field in my table. I wanted to get this field and get into a variable and show in the view. Thank you !!
Good evening, how do I get a specific field in my table. I wanted to get this field and get into a variable and show in the view. Thank you !!
Is the view relative to the same table model or different? If it's the same:
$total = $sales['Sale']['valor'];
If it is different, in the controller of your view, it is:
public function view(){
$this->loadModel('Sale');
$sales = $this->Sale->find('list', array('fields' => array('Sale.valor')));
$this->set('valor', $valor);
Then in view.ctp:
$total = $valor['Sale']['valor'];