display from database - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: display from database (/showthread.php?tid=27377) Pages:
1
2
|
display from database - El Forum - 02-09-2010 [eluser]new kid[/eluser] NEW TO CODEIGNITER .NEED HELP hi i was creating a demo site for a school and i need to display(display is using echo table) all the details from a table called students .how to create model and controller and how to get the values in view . please give some samples i need to role id also to this view because i want to change the table display according to the people(students/teachers) logging in display from database - El Forum - 02-09-2010 [eluser]kirkaracha[/eluser] Controller (controllers/students.php): Code: <?php Model (models/students_model.php): Code: <?php View (views/students/list.php): Code: <h1><?php echo $page_title; ?></h1> display from database - El Forum - 02-09-2010 [eluser]new kid[/eluser] THANKS A LOT BROTHER wish u the best display from database - El Forum - 02-09-2010 [eluser]new kid[/eluser] PASSING VARIABLE tO VIEW i need to pass role id variable also to this view because i want to change the table display according to the people(students/teachers) logging in when they log in a session is created and i want to pass this session variable to this same view please tell me how display from database - El Forum - 02-09-2010 [eluser]saidai jagan[/eluser] Code: $data = array( display from database - El Forum - 02-10-2010 [eluser]new kid[/eluser] i hav set session in login page by $this->session->set_userdata('$role'); $role is from database then i used ur code to send the values $data = array( 'page_title' => 'Students', 'students' => $students->result(), 'role_id' => $this->session->user_data('role_id'); ); $this->load->view('students/list',$data); how to get this value in view i hav to store it in a variable please help display from database - El Forum - 02-10-2010 [eluser]saidai jagan[/eluser] Code: echo $role_id; display from database - El Forum - 02-10-2010 [eluser]new kid[/eluser] iam not getting the value please check the code i hav used $role in setting userdata display from database - El Forum - 02-10-2010 [eluser]saidai jagan[/eluser] Code: echo $this->session->userdata('role_id'); display from database - El Forum - 02-10-2010 [eluser]new kid[/eluser] still not getting wat is this list students/list |