Passing Data to a Model - 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: Passing Data to a Model (/showthread.php?tid=11213) |
Passing Data to a Model - El Forum - 08-30-2008 [eluser]Jesse Schutt[/eluser] So, forums are places to ask questions, right? Hopefully you can help me out with this simple one. I have a need to update a field on my DB. So I should have that function with in my model, correct? Here is the code for my controller Code: $paypal_custom_field = explode(":", $this->paypal_lib->ipn_data['custom']); Here is what is in my model function called "verify_payment" Code: function verify_payment() I just can't get this to update the "payment_received" field. If I take the code from the model and put it into my controller, it will update the field correctly. So I am assuming that it has to do with passing the array to the model. Any ideas? Thanks in advance! Jesse Passing Data to a Model - El Forum - 08-30-2008 [eluser]m4rw3r[/eluser] You have to pass the $paypal_custom_field as a parameter to verify_payment(): Code: // controller Passing Data to a Model - El Forum - 08-30-2008 [eluser]Jesse Schutt[/eluser] Haven't I already done that by passing the $paypal_custom_field array? Passing Data to a Model - El Forum - 08-30-2008 [eluser]m4rw3r[/eluser] No: Code: function verify_payment() Passing Data to a Model - El Forum - 08-30-2008 [eluser]Jesse Schutt[/eluser] So it needs to be in both the () inside of the controller as well as in the model? Passing Data to a Model - El Forum - 08-30-2008 [eluser]Jesse Schutt[/eluser] Also, is it better to run the explode in the model, rather than the controller? Passing Data to a Model - El Forum - 08-30-2008 [eluser]Jesse Schutt[/eluser] Wow! It worked! So I pass whatever I want in the controller and than I can use it by whatever variable I assign it in the model? Code: //controller Passing Data to a Model - El Forum - 08-30-2008 [eluser]m4rw3r[/eluser] yeah Passing Data to a Model - El Forum - 08-30-2008 [eluser]Jesse Schutt[/eluser] Thanks for your time! Passing Data to a Model - El Forum - 08-30-2008 [eluser]m4rw3r[/eluser] You're welcome. |