Jump to content


setRelation returns similar values not only the exact

setRelation mysql

  • Please log in to reply
5 replies to this topic

#1 wildfandango

wildfandango

    Member

  • Members
  • PipPip
  • 24 posts

Posted 09 January 2018 - 09:41 AM

Hello everyone and happy new year!
 
The error that happens to me, possibly related to the database, is very rare and I do not know what can be due or how to solve it ...
:, (
 
I have two related tables
 
_log.usu -> _usu.id
(both fields are of type INT)
 
in the following way:
 
$crud->setRelation('usu', '_ usu', 'name');
In my production environment the GRID shows all the _usu whose ID contains part of the first one, I mean.
 
If _log.usu is 3, all users with id 3, 30, 31 will be shown
 
example, for:
_log.usu = 3
 
users showed:
 
3 -> John
30 -> Marta
31 -> Donald
 
8O ??!!!
 
Any idea of what the problem may be and how to solve it? Thank you
 
P.S. The MySQL version is 5.6.19


#2 wildfandango

wildfandango

    Member

  • Members
  • PipPip
  • 24 posts

Posted 11 January 2018 - 09:39 AM

This is my complete code, any ideas? I'm totally lost

 

        $crud = $this->GCRUD_getGroceryCrudEnterprise();
        $crud->setTable('_log');
        $crud->setSubject("LOG","Registro de LOGS");
        $crud->setTheme($this->ciies_model->cfg()["visual_theme"]);


        $crud->columns(['fec','usu','act','pan','reg']);
        $crud->fields(['fec','usu','act','pan','reg','txt']);


        $crud->displayAs('fec','Fecha/Hora');
        $crud->displayAs('usu','Usuario');
        $crud->displayAs('act','Acción');
        $crud->displayAs('pan','Pantalla');
        $crud->displayAs('reg','ID de REGISTRO');
        $crud->displayAs('txt','Descripción');


        $crud->setRelation('usu','_usu','nombre');


        $crud->setRead();
        $crud->unsetAdd();
        $crud->unsetEdit();
        $crud->unsetDelete();


        $crud->defaultOrdering('fec','desc');


        $output = $crud->render();


#3 darkstalker

darkstalker

    Member

  • Members
  • PipPip
  • 21 posts
  • LocationItaly

Posted 11 January 2018 - 02:44 PM

have you tried to change table name from _usu to something else ?

I feel that the similar name of field and table could produce strange behavior.

Try and see if that resolve the issue



#4 wildfandango

wildfandango

    Member

  • Members
  • PipPip
  • 24 posts

Posted 11 January 2018 - 07:17 PM

It was a possibility, but I tried to rename the _usu table by appusers and the result is exactly the same

 

 

Screenshot



#5 wildfandango

wildfandango

    Member

  • Members
  • PipPip
  • 24 posts

Posted 05 March 2018 - 10:39 AM

After upgrading to version 2.5.1 the problem has been fixed



#6 luciferbrown

luciferbrown

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 20 June 2018 - 07:10 PM

The set relation in SQL server which returns the similar values but not the exact value so, for that, you can find out the way to follow it after the version updated then from knowing the process is in condition mode instead of that dell printer support will find out the solution for the above query.







0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users