User can't be found for some reason |
[eluser]xtremer360[/eluser]
I'm trying to figure out how to fix the issues that presented to the console when I submit my login form. Login Controller: http://pastebin.com/C24MBL46 Code: array(1) {
[eluser]Aken[/eluser]
You're trying to extract something that's in the wrong format. Try having your get_user_data() user model method return something like this: Code: return $query->row_array();
[eluser]Egill Th[/eluser]
Fix this by altering your code like so; Code: private function check_user_status_id( $user_status_id = 0 ) { Regarding the $message error personally I would define the variable and use it like so; Code: var $message; Alternatively you can disable E_NOTICE errors but it is good practice to define your variables before using them. To fix the fact that you aren't getting the proper $user_status_id you can edit your code to something like this; Code: public function submit() {
[eluser]Egill Th[/eluser]
For some reason I posted another reply instead of updating my existing one. ^
[eluser]xtremer360[/eluser]
I updated my code. What I'm trying to do is always work with objects and not arrays but I am getting a trying to get property of a non object on the login function in the list of functions and where it says $user_data->password_hash AND $user_data->password just a few lines down from that. http://pastebin.com/BkkTp2cG Code: /** Code: public function get_user_data( $username )
[eluser]Egill Th[/eluser]
Personally I would not check if the query is sane inside the model and ust return the result without any logic. Code: public function get_user_data($username) { I'm not sure why you would want to convert the stdClass to something else, but you could always just do something like this; Code: $user_data = $this->ci->users_model->get_user_data($post_username); I typically use a custom Model class and when I select data from a single table I do something along these lines; Code: public function doStuff($id) { There are multiple database ORMs available for CodeIgniter that may possibly do this for you or you can write your own simple class. |
Welcome Guest, Not a member yet? Register Sign In |