Welcome Guest, Not a member yet? Register   Sign In
Return users's id from the db
#1

[eluser]Mowgli[/eluser]
Hello guys,

I'm pretty new into php and i just started working with codeigniter.
Here's something i can't figure out:
Code:
$usr = $this->input->post('username');
$sql = "SELECT id FROM membership WHERE username=$usr";
if($sql['id']==37)$data['main_content'] = 'admins_area';
else $data['main_content'] = 'members_area';
$this->load->view('includes/template', $data);
Basically, what i am trying to do is: "if the username that just logged in has the id equal to 37 then he's an administrator and the admins_area will be loaded". However, even if the user with the id 37 logs in, the members_area view is being loaded.
What am i doing wrong ? Thanks in advance.


Messages In This Thread
Return users's id from the db - by El Forum - 05-23-2011, 01:12 PM
Return users's id from the db - by El Forum - 05-23-2011, 02:44 PM
Return users's id from the db - by El Forum - 05-23-2011, 02:59 PM
Return users's id from the db - by El Forum - 05-23-2011, 03:06 PM



Theme © iAndrew 2016 - Forum software by © MyBB