User Login |
[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
[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));
[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?>
[eluser]clip[/eluser]
You can either add them to a session or change your return from your model Code: //change
[eluser]GamingFusion[/eluser]
did work man here my code Code: function checkLogin()
[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;
[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
[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.
[eluser]GamingFusion[/eluser]
theres something wrong with the login script. The Login script isn't checking anything Code: function login() |
Welcome Guest, Not a member yet? Register Sign In |