HELP joining tables... - 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: HELP joining tables... (/showthread.php?tid=37481) Pages:
1
2
|
HELP joining tables... - El Forum - 01-11-2011 [eluser]chazy (aldever calvo)[/eluser] hello i really need help in joining tables for my get function i have 3 tables: user ----- user_id(pk) user_type_id(fk) user_det_id(fk) user_type --------- user_type_id(pk) user_details ------------ user_det_id(pk) i had it joined and successfully output the result... but the problem is... i cannot do pagination with it... my past code is this Code: function GetAllDetails() and so what i did is change it into: Code: function GetAllDetails() But i have errors: A PHP Error was encountered Severity: Notice Message: Undefined variable: userId Filename: models/user_model.php Line Number: 45 A PHP Error was encountered Severity: Warning Message: preg_match() expects parameter 2 to be string, object given Filename: database/DB_driver.php Line Number: 616 Please help me... HELP joining tables... - El Forum - 01-11-2011 [eluser]Ochetski[/eluser] The first error means that the variable $userId is not defined. I see it here: $this->db->where('choy_user_id', $userId); And the second error means that your preg_match function is receiving a wrong parameter, it should be text but you've sent an object, maybe something like $this->input when it must be $this->input->post('test'), check the second parameter of it somewhere. HELP joining tables... - El Forum - 01-11-2011 [eluser]chazy (aldever calvo)[/eluser] the second error about the pregmatch is already solved... the first error which is about the userId... I still can't fix it.... HELP joining tables... - El Forum - 01-11-2011 [eluser]chazy (aldever calvo)[/eluser] Code: function GetAllDetails() A PHP Error was encountered Severity: Notice Message: Undefined variable: userId Filename: models/user_model.php Line Number: 45 this is for my controller... Code: function index() i can't seem to find a way why i have error Undefined variable: userId even if i do it this way $data['users'] = $this->user_model->GetAllDetails($userId); HELP joining tables... - El Forum - 01-11-2011 [eluser]Bart Mebane[/eluser] Did you do this? Code: function GetAllDetails($userId) HELP joining tables... - El Forum - 01-11-2011 [eluser]chazy (aldever calvo)[/eluser] [quote author="Bart Mebane" date="1294790748"]Did you do this? Code: function GetAllDetails($userId) yes, i also did that already... HELP joining tables... - El Forum - 01-11-2011 [eluser]chazy (aldever calvo)[/eluser] i have this in my model now Code: function GetAllDetails($userId) and this in my controller Code: function index() now i have new error.. still about my userId A PHP Error was encountered Severity: Notice Message: Undefined variable: userId Filename: controllers/users.php Line Number: 97 line 97 is this $data['users'] = $this->user_model->GetAllDetails($userId); HELP joining tables... - El Forum - 01-11-2011 [eluser]Bart Mebane[/eluser] Where is $userId coming from? Is it in the URL? HELP joining tables... - El Forum - 01-11-2011 [eluser]Ochetski[/eluser] [quote author="Bart Mebane" date="1294792239"]Where is $userId coming from? Is it in the URL?[/quote] No it's a model, but i guess he's calling this method without the first parameter or it's null. HELP joining tables... - El Forum - 01-11-2011 [eluser]chazy (aldever calvo)[/eluser] i dont have it in my url... this is my url Code: <div class="content"> |