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

Column not found: 1054 Unknown column in where clause

relation setrelation column where

  • Please log in to reply
1 reply to this topic

#1 ajuser



  • Members
  • Pip
  • 3 posts

Posted 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');
        ->displayas('fechadesde','Desde fecha')
        ->displayas('fechahasta','Hasta fecha')
        ->displayas('numerohora','Horas semanales');
   //   $crud->setrules('fechahasta', 'Hasta', 'callback_valid_date');
 $crud->setrelation('idpersona','persona','{apellido}, {nombre}',['idcentro'=>$center]);
      $output = $crud->render();


Attached Thumbnails

  • DB.png

#2 larasmith


    Advanced Member

  • Members
  • PipPipPip
  • 200 posts

Posted 04 March 2020 - 06:29 AM

Hi ajuser,


Try adding: $crud->setPrimaryKey('idcentro','persona'); before $crud->setrelation('idpersona','persona','{apellido}, {nombre}',['idcentro'=>$center]);

I hope this helps!  :)

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users