⚠ In case you've missed it we are migrating to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. Very soon this forum will be read-only and archived. ⚠


ajuser

Member Since 29 Mar 2015
Offline Last Active May 28 2020 09:19 PM
-----

Topics I've Started

Column not found: 1054 Unknown column in where clause

12 February 2020 - 07:57 AM

Good, I am trying to make a simple relationship between two tables, but when I put the where clause, it shows that it does not find the idcentro column.
I detail the controller code and the image of the tables.
In the community version it works without problems.
 
 
<p>Type: PDOException</p>
<p>Message: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'idcentro' in 'where clause'</p>
<p>Filename: /var/www/vhosts/control.instalnox.com/httpdocs/application/libraries/GroceryCrudEnterprise/zendframework/zend-db/src/Adapter/Driver/Pdo/Connection.php</p>
<p>Line Number: 360</p>

 

 

function list_contrato() {

      $crud = $this->_getGroceryCrudEnterprise();  
      $center = $this->session->userdata('idcentro');
      $crud->settable('contrato');
      $crud->setsubject('Contratos');
      $crud->columns(['idpersona','descripcion','fechadesde','fechahasta','numerohora'])
        ->displayas('idpersona','Trabajador')
        ->displayas('descripcion','DescripciĆ³n')
        ->displayas('fechadesde','Desde fecha')
        ->displayas('fechahasta','Hasta fecha')
        ->displayas('numerohora','Horas semanales');
      $crud->requiredfields(['idpersona','descripcion','fechadesde','numerohora']);
   //   $crud->setrules('fechahasta', 'Hasta', 'callback_valid_date');
 $crud->setrelation('idpersona','persona','{apellido}, {nombre}',['idcentro'=>$center]);
 $crud->where(['idcentro'=>$center]); 
      $output = $crud->render();
 $this->_main_output($output);
}