Jump to content


Manu Sharma

Member Since 05 Jul 2013
Offline Last Active Jul 11 2013 09:11 AM
-----

Posts I've Made

In Topic: Problem with alias while setting relation with same table.

05 July 2013 - 12:29 PM

thanks


In Topic: Problem with alias while setting relation with same table.

05 July 2013 - 11:48 AM

Hi,

 

Thanks.

 

I'm managing sub users in same table using parent_id, when parent_id = 0 then its parent user and otherwise it will have primary id of other user from same table as its parent_id so that I can show the parent users in the dropdown from same table while adding more users, thats why i need it, i was doubtful that this way of managing the database is wrong. I should have taken two different tables or is there any better way with which I can sort it out or this db structure is totally unacceptable.

 

Regards,

Manu


In Topic: Problem with alias while setting relation with same table.

05 July 2013 - 10:47 AM

Now I'm dong it like this ->

if($crud->getState() != 'add' && $crud->getState() != 'edit')
{
   $crud->set_relation('parent_id','users u','u.username',array('parent_id' => 0));
}
else
{
   $crud->set_relation('parent_id','users','username',array('parent_id' => 0));
}

I think this is not the right way, there should be something else what I must have missed.