[SOLVED] yet another DB related problem - 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: [SOLVED] yet another DB related problem (/showthread.php?tid=26539) Pages:
1
2
|
[SOLVED] yet another DB related problem - El Forum - 01-16-2010 [eluser]KrizzAngel[/eluser] is this right on representing the query "select * from tblstudent where username = session"?? Quote: function upanel() and also i dont know if my display result is right coz im getting blank result on that field. here it is: Quote:Welcome <?php foreach($un->result() as $surname): ?> P.S. i have a working list of topic on same page which where i used the $data['list']=$this->db->get('tbltopic'); using the result pattern above. [SOLVED] yet another DB related problem - El Forum - 01-16-2010 [eluser]JHackamack[/eluser] Your first query is correct. The second loop though is a little off, why not use the ->row() to just return one row, unless you want to have multiple names in the Welcome statement. [SOLVED] yet another DB related problem - El Forum - 01-16-2010 [eluser]KrizzAngel[/eluser] ok i got it working now and use row() to display result but what i did is change this Quote:$this->session->userdata('$ses');to Quote:$this->input->post('username'). i dunno why it doesnt retrieve the value from login function from controller if my code is like this: Quote: function upanel() [SOLVED] yet another DB related problem - El Forum - 01-16-2010 [eluser]JHackamack[/eluser] AH, i see the problem $this->session->userdata(’$ses’); won't evaluate to the $ses variable because its in single quotes. The best way is to remove the quotes all together $this->session->userdata($ses); If you really want to use quotes, wrap $ses in " $this->session->userdata("$ses"); [SOLVED] yet another DB related problem - El Forum - 01-16-2010 [eluser]KrizzAngel[/eluser] cool, i didnt expect that single qoute is differ from none or double qoute XD.. tnx [SOLVED] yet another DB related problem - El Forum - 01-16-2010 [eluser]KrizzAngel[/eluser] oh wait i thought it was all working.. funny.. i got the name but theres an error on top saying "Message: Undefined variable: ses Filename: controllers/mont.php Line Number: 16" :'( P.S. im uploading an IMG file coz to show the error more clearly.. cant post an IMG. [SOLVED] yet another DB related problem - El Forum - 01-16-2010 [eluser]JHackamack[/eluser] Is line 16 of your mont controller : $ses = array( ‘username’ => $this->input->post(‘username’), ‘is_logged_in’ => true ); $this->session->set_userdata(’$ses’); $this->upanel(); Or is it something different? [SOLVED] yet another DB related problem - El Forum - 01-16-2010 [eluser]KrizzAngel[/eluser] no, the line 16 is Quote: function upanel() [SOLVED] yet another DB related problem - El Forum - 01-16-2010 [eluser]JHackamack[/eluser] are you calling upanel() before you validate_credentials. If you do then your userdata isn't set. [SOLVED] yet another DB related problem - El Forum - 01-16-2010 [eluser]KrizzAngel[/eluser] nope. as you can see on my first post. after logging in i'm calling validate credentials before goin to upanel.. |