Welcome Guest, Not a member yet? Register   Sign In
display from database
#11

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

[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)
#13

[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.
#14

[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
#15

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

[eluser]new kid[/eluser]
thanks
#17

[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




Theme © iAndrew 2016 - Forum software by © MyBB