Self table relation
- Single Page
Posted 29 June 2012 - 02:48 AM
Here is my work-around and (possibly) a solution:
https://github.com/scoumbourdis/grocery-crud/issues/71
Posted 29 June 2012 - 06:45 AM
Posted 27 July 2015 - 00:50 AM
I tried doing as per your suggestion @goFrendiAsgard but didn't work.
instead of this :
$crud->set_relation('reportstouser_id','`org_users`','{first_name} {last_name}');
I had to fetch table array and use field type: dropdown to avoid self set_relation.
CREATE TABLE IF NOT EXISTS `org_users` ( `id` int(11) NOT NULL, `photo` varchar(265) COLLATE utf8_unicode_ci NOT NULL, `first_name` varchar(55) COLLATE utf8_unicode_ci NOT NULL, `middlename` varchar(35) COLLATE utf8_unicode_ci NOT NULL, `last_name` varchar(55) COLLATE utf8_unicode_ci NOT NULL, `comment` varchar(55) COLLATE utf8_unicode_ci DEFAULT NULL, `birthdate` varchar(15) COLLATE utf8_unicode_ci NOT NULL, `mobile` varchar(25) COLLATE utf8_unicode_ci NOT NULL, `password` varchar(50) COLLATE utf8_unicode_ci NOT NULL, `role` varchar(55) COLLATE utf8_unicode_ci NOT NULL, `department_id` int(11) NOT NULL, `reportstouser_id` int(11) NOT NULL, `school_id` int(5) NOT NULL, `rights` varchar(7500) COLLATE utf8_unicode_ci NOT NULL, `email_address` varchar(25) COLLATE utf8_unicode_ci NOT NULL, `postaladdress` varchar(200) COLLATE utf8_unicode_ci NOT NULL, `joiningdate` varchar(12) COLLATE utf8_unicode_ci NOT NULL, `experience` varchar(10) COLLATE utf8_unicode_ci NOT NULL, `notes` text COLLATE utf8_unicode_ci NOT NULL, `active` tinyint(1) NOT NULL DEFAULT '0', `deleted` tinyint(1) NOT NULL DEFAULT '0' ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;