User Login - 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: User Login (/showthread.php?tid=24192) |
User Login - El Forum - 11-02-2009 [eluser]GamingFusion[/eluser] Ok i added this code to my .htaccess file Code: php_value display_errors 1 and that gave me an error about get_cookie() so i forgot to load the cookie helper. now i get this error Quote:Fatal error: Cannot use object of type CI_DB_mysql_result as array in /Users/chadgregory/Sites/ci/system/application/models/database.php on line 129 heres my code for the database.php file(model) with a star on line 129 Code: function checkLogin() basically i want it to assign the id and username of the user who is logged in into the two variables User Login - El Forum - 11-03-2009 [eluser]clip[/eluser] Please read the user guide on how to work with query results Code: $logged = $this->db->get_where('users', array ('username' => $u1, 'password' => $p1)); User Login - El Forum - 11-03-2009 [eluser]GamingFusion[/eluser] ok that worked thanks man, the code i ahd there before was from my user system i made in php a few months ago. But now i was wandering how to return the variable $uId and $uName to the page that i execute the function on so i can do something like this: Code: <?="Your Id is: ", $uId?> User Login - El Forum - 11-03-2009 [eluser]clip[/eluser] You can either add them to a session or change your return from your model Code: //change User Login - El Forum - 11-03-2009 [eluser]GamingFusion[/eluser] did work man here my code Code: function checkLogin() User Login - El Forum - 11-03-2009 [eluser]clip[/eluser] [quote author="GamingFusion" date="1257318289"]did work man here my code Code: function checkLogin() To get access to your returned data you need to do in your controller Code: $userdata = $this->model_name->checkLogin(); Also to make things cleaner instead of returning just the $data array you could Code: return $row; User Login - El Forum - 11-04-2009 [eluser]GamingFusion[/eluser] ok thanks man that makes sense User Login - El Forum - 11-04-2009 [eluser]GamingFusion[/eluser] still nothing heres my function that im use to get the variables to display Code: function index() The title and heading variables work but not uId User Login - El Forum - 11-04-2009 [eluser]jedd[/eluser] Quote:The title and heading variables work but not uId This might be how to suck eggs stuff, but when you say 'not uId' it's unclear what you've done. Obviously the first thing would be an echo 'hi!' in your if {} block, just to prove out you're getting past the conditional. Or even a var_dump. I'd like to assume you've already done this, as it's pretty basic PHP debugging stuff - but if you had, then you'd have solved your problem already I think. User Login - El Forum - 11-05-2009 [eluser]GamingFusion[/eluser] theres something wrong with the login script. The Login script isn't checking anything Code: function login() |