![]() |
Loading a Model is not working for me. Please help - 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: Loading a Model is not working for me. Please help (/showthread.php?tid=2232) |
Loading a Model is not working for me. Please help - El Forum - 07-24-2007 [eluser]n00bPhpCoder[/eluser] Well after that URL problem that was fixed a while ago here i am again with another problem that i cannot figure out myself. According to the manual when loading a model and if you want to assign it to a variable you do this $this->load->model('modelfilename','modelnameyouwant'); then you can do this $this->modelnameyouwant->function(); But everything seems to work fine before i uploaded all my files to my web host. This is the error Call to a member function on a non-object it seems that $this->modelnameyouwant is not an object? and i cant access its functions? everything works fine on my local machine using apache 2.2 and php5.x under my webhost aoache is 1.3 and php4.4 I read about chaining in php4 is not allowed s i did that and i was able to fix the problem. but this i cant get it to work. Any Ideas? Loading a Model is not working for me. Please help - El Forum - 07-24-2007 [eluser]coolfactor[/eluser] Please try to use [ code ] tags around your code samples. It makes it easier to read. This is not method chaining. It works just fine on php4. Code: $this->modelnameyouwant->function(); After loading the model, trying using var_dump() on it. Code: $this->load->model('modelfilename', 'modelnameyouwant'); Also, it really helps if you use your real code, not pretend code. Even the slightest difference can be the cause of the problem, so show us exactly what you are using in your code. Loading a Model is not working for me. Please help - El Forum - 07-24-2007 [eluser]n00bPhpCoder[/eluser] im sorry okay here it is: This one is for viewing the Comments Code: function View($id){ i created this one Code: class Vardump extends Controller { and it say object. Did i do something wrong on the code above? I think theyre pretty much the same Loading a Model is not working for me. Please help - El Forum - 07-24-2007 [eluser]coolfactor[/eluser] Ah, the problem may be the "View" function you defined. That would conflict with the ->load->view() method under PHP4. Try renaming your function to something else to see if the problem goes away. Loading a Model is not working for me. Please help - El Forum - 07-24-2007 [eluser]n00bPhpCoder[/eluser] I see, maybe that was causing the problem. Okay i will try that. I should rename my functions to a more unique and meaningful ones ![]() Loading a Model is not working for me. Please help - El Forum - 07-24-2007 [eluser]n00bPhpCoder[/eluser] Sir, that was causing the problems. I never it was a conflict on other reserved function for CI. Where learned a lot today. ![]() I wish everyone would be so patient to answer our questions though we are still a noob ![]() |