Hi,
i developing web application in core php.
we have five panels superadmin, admin, medical, staff, customer.
all records should be display superadmin and created by users.
please help me to write a mysql query
below my basic query.
$user = $DB->prepare("SELECT `u_userid`, `u_username`, `u_password`, `u_rolecode`, `firstname`, `lastname`, `sex`, `age`, `email`, `telephone`, `mobile`, `company`, `location`, `address1`, `address2`, `country`, `profile`, `status` FROM `np_system_users` ORDER BY u_userid LIMIT $start_from, 25");
table name: np_system_users
CREATE TABLE IF NOT EXISTS `np_system_users` (
`u_userid` int(11) NOT NULL AUTO_INCREMENT,
`u_username` varchar(100) NOT NULL,
`u_password` varchar(255) NOT NULL,
`u_rolecode` varchar(50) NOT NULL,
`firstname` varchar(20) NOT NULL,
`lastname` varchar(20) NOT NULL,
`sex` varchar(10) NOT NULL,
`age` varchar(10) NOT NULL,
`email` varchar(50) NOT NULL,
`telephone` varchar(20) NOT NULL,
`mobile` varchar(20) NOT NULL,
`company` varchar(50) NOT NULL,
`location` varchar(100) NOT NULL,
`address1` text NOT NULL,
`address2` text NOT NULL,
`country` varchar(10) NOT NULL,
`profile` varchar(100) NOT NULL,
`status` varchar(100) NOT NULL DEFAULT '0',
`createdby` varchar(100) NOT NULL,
`headofdomain` varchar(100) NOT NULL,
`visible1` varchar(100) NOT NULL,
`visible2` varchar(100) NOT NULL,
`visible3` varchar(100) NOT NULL,
PRIMARY KEY (`u_userid`),
KEY `u_rolecode` (`u_rolecode`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
Insert code
INSERT INTO `np_system_users` (`u_userid`, `u_username`, `u_password`, `u_rolecode`, `firstname`, `lastname`, `sex`, `age`, `email`, `telephone`, `mobile`, `company`, `location`, `address1`, `address2`, `country`, `profile`, `status`, `createdby`, `headofdomain`, `visible1`, `visible2`, `visible3`) VALUES
(33, 'Torsignia', '5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8', 'SUPERADMIN', 'prabaweb', 'P', 'Male', '23', 'superadmin@prabaweb.com', '5476544767432', '86876767438', 'prabaweb', 'Koramangala 4 Block, Koramangala, Bengaluru, Karnataka, India', 'Koramangala 4 Block, Koramangala, Bengaluru, Karnataka, India', 'Koramangala 4 Block, Koramangala, Bengaluru, Karnataka, India', 'India', 'uploads/Screen Shot 2015-01-28 at 15.38.08.png', '1', 'superadmin@prabaweb.com', '', '', 'SUPERADMIN', ''),
(34, 'prabakaran', '5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8', 'ADMIN', 'prabakaran', 'P', 'Male', '23', 'prabakaranp@hotmail.com', '89686567686', '867687686878', 'prabaweb', 'The Koramangala Club, Bengaluru, Karnataka, India', 'Koramangala, Bengaluru, Karnataka, India', 'Koramangala, Bengaluru, Karnataka, India', 'India', 'uploads/Penguins.jpg', '1', 'superadmin@prabaweb.com', '', '', 'SUPERADMIN', ''),
(36, 'staff', '5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8', 'STAFF', 'staff', 's', 'Male', '23', 'staff@prabaweb.com', '56554764655', '646545656', 'prabaweb', 'Koramangala 4 Block, Koramangala, Bengaluru, Karnataka, India', 'Koramangala 4 Block, Koramangala, Bengaluru, Karnataka, India', 'Koramangala 4 Block, Koramangala, Bengaluru, Karnataka, India', 'India', 'uploads/1.jpg', '1', 'superadmin@prabaweb.com', '', '', 'SUPERADMIN', ''),
(37, 'praba', '5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8', 'MEDICAL', 'prabakaran', 'p', 'Male', '23', 'praba@prabaweb.in', '8897464647', '6666', '66', 'Majestic, Bengaluru, Karnataka, India', 'Majestic, Bengaluru, Karnataka, India', 'Majestic, Bengaluru, Karnataka, India', 'India', 'uploads/3.jpg', '1', 'admin@gmail.com', 'admin medical', '', 'SUPERADMIN', ''),
(38, 'admin@praba.com', '5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8', 'ADMIN', 'admin', 'p', 'Male', '25', 'admin@gmail.com', '9972396115', '8904655783', 'prabaweb', 'Koramangala 4 Block, Koramangala, Bengaluru, Karnataka, India', 'koramangala', 'koramanagala', 'India', 'uploads/Penguins.jpg', '1', 'superadmin@prabaweb.com', 'nammapharma', '', 'SUPERADMIN', '');