hamza Posted March 12, 2010 Share Posted March 12, 2010 i am selecting user from drop down list and after selecting form submit. and user id submited .on the bases of user_id i need to show user right on all module. how i can do that using one query. my schema ======== CREATE TABLE `tblactions` ( `action_id` int(11) NOT NULL auto_increment, `actions` varchar(255) default NULL, PRIMARY KEY (`action_id`) ) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1; CREATE TABLE `tblmoduleactions` ( `moduleaction_id` int(10) NOT NULL auto_increment, `module_id` int(10) default NULL, `action_id` int(10) default NULL, PRIMARY KEY (`moduleaction_id`) ) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; CREATE TABLE `tblmodules` ( `module_id` int(10) NOT NULL auto_increment, `module_name` varchar(255) default NULL, PRIMARY KEY (`module_id`) ) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1; CREATE TABLE `tbluserrights` ( `userrights_id` int(10) NOT NULL auto_increment, `user_id` int(10) default NULL, `moduleaction_id` int(10) default NULL, PRIMARY KEY (`userrights_id`) ) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; INSERT INTO `tblactions` VALUES ('1', 'Add'); INSERT INTO `tblactions` VALUES ('2', 'Update'); INSERT INTO `tblactions` VALUES ('3', 'Delete'); INSERT INTO `tblactions` VALUES ('4', 'List'); INSERT INTO `tblmodules` VALUES ('1', 'Manage Category'); INSERT INTO `tblmodules` VALUES ('2', 'Manage Products'); INSERT INTO `tblmodules` VALUES ('3', 'Manage Users'); INSERT INTO `tblmodules` VALUES ('4', 'Manage Manufacture'); INSERT INTO `tbluserrights` VALUES ('1', '11', '1'); INSERT INTO `tbluserrights` VALUES ('2', '12', '2'); INSERT INTO `tblmoduleactions` VALUES ('1', '1', '1'); INSERT INTO `tblmoduleactions` VALUES ('2', '2', '1'); INSERT INTO `tblmoduleactions` VALUES ('3', null, null); Link to comment https://forums.phpfreaks.com/topic/195048-query-help/ Share on other sites More sharing options...
fenway Posted March 16, 2010 Share Posted March 16, 2010 What do you have so far? Link to comment https://forums.phpfreaks.com/topic/195048-query-help/#findComment-1026903 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.