Can somebody help me please? - 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: Can somebody help me please? (/showthread.php?tid=31573) |
Can somebody help me please? - El Forum - 06-24-2010 [eluser]Christophe28[/eluser] Hello, I have a 2 variables which I have available in a method. I want to pass these to the model, but I don't know how. I'm new in CI and OOP -> but I hope somebody can help me ... For now I have: Code: function photo_view_function($username, $caption) And the model Code: function getSinglePhoto($username, $caption) { But no mather what I try, I get errors Can someone help me plz Thx! Can somebody help me please? - El Forum - 06-24-2010 [eluser]WanWizard[/eluser] Would help to know what the errors are... For starters, you can not pass an array to $this->load-model. The second parameters should be a string defining an alternative object name. Then you define the method getSinglePhoto() as having two parameters, yet when you call it no parameters are passed... Can somebody help me please? - El Forum - 06-24-2010 [eluser]Christophe28[/eluser] Hi, Oops, I'm sorry. Here are the (many) errors: Code: A PHP Error was encountered I'm really stuck here Can you give me a small setup, hint, or even a link to a tutorial plz? I have searched things like 'passing data from controller to model' but can't find anything useful ... Thank you for helping out! Christophe Can somebody help me please? - El Forum - 06-24-2010 [eluser]WanWizard[/eluser] Did you even read past the first line of my answer? You get the "Array to string conversion" error because you pass an array as parameter to the $this->load->model() loader, while it expects a string value there. The CI online manual is excellent, I suggest starting there. Can somebody help me please? - El Forum - 06-24-2010 [eluser]Christophe28[/eluser] Yes, I knew that was giving an error, but I didn't know how to put those two parameters in one string, therefore asked for little help. I already looked at database class in the userguide, but I'll take a closer look. Can somebody help me please? - El Forum - 06-24-2010 [eluser]Christophe28[/eluser] Ooh, found out what was going wrong. I'll post the solution when it is ready Thx! |