Get value from DB - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Get value from DB (/showthread.php?tid=54488) |
Get value from DB - El Forum - 09-11-2012 [eluser]shahnawazahmed[/eluser] Hello everyone , i want to fetch value from db column directly from my controller , i am stucked in this task please share me the code , How can i get value from the db column in controller . please reply soon , anyone please Get value from DB - El Forum - 09-11-2012 [eluser]shahnawazahmed[/eluser] its my controller <?php class site extends CI_controller { function index() { $this->load->model('getdb'); $a=$this->getdb->getall(); echo $a; } } ?> and here is the model <?php class getdb extends CI_Model{ public function getall() { echo $query= $this->db->query('SELECT user_role FROM res_user'); } } ?> i want to fetch value from the db column user_role ... Get value from DB - El Forum - 09-11-2012 [eluser]michalsn[/eluser] Start from here: http://ellislab.com/codeigniter/user-guide/database/results.html |