CodeIgniter Forums
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-10-2010

[eluser]saidai jagan[/eluser]
u assigned the role id to session
Code:
echo $this->session->userdata('role_id');



display from database - El Forum - 02-10-2010

[eluser]new kid[/eluser]
yes i did

how did u store the value of $role in session


and wat is session/list

(sorry 4 asking such stupid questions ,but please help)


display from database - El Forum - 02-10-2010

[eluser]saidai jagan[/eluser]
[quote author="ceig" date="1265803861"]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[/quote]

By this code alter it to
Code:
$role_ids = array('role_id' => $role);
$this->session->set_userdata($role_ids);
$data = array(
                'page_title' => 'Students',
                'students' => $students->result(),
                'role_id' => $this->session->userdata('role_id');
            );
echo $data['role_id'];
Note : students/list is already there. I just copied the code.


display from database - El Forum - 02-10-2010

[eluser]new kid[/eluser]
thank you brother :-) thank u

its working


one more doubt

how to select data from a table from db using WHERE condition in codeigniter .

example list of students whose marks=90


display from database - El Forum - 02-10-2010

[eluser]saidai jagan[/eluser]
check <a href="http://ellislab.com/codeigniter/user-guide/database/active_record.html#select">here</a>


display from database - El Forum - 02-10-2010

[eluser]new kid[/eluser]
thanks


display from database - El Forum - 02-10-2010

[eluser]new kid[/eluser]
i want to pass a single value from view through href to a function in controller and from there to model how ??

please help