![]() |
Model problems - 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: Model problems (/showthread.php?tid=9307) Pages:
1
2
|
Model problems - El Forum - 06-20-2008 [eluser]stuffradio[/eluser] How would you do a model for a user table. This is mine but it isn't updating. Code: <?php Model problems - El Forum - 06-21-2008 [eluser]treehousetim[/eluser] Assuming you're setting the values into the proper variables in your model, and assuming you're calling the update method, this should work. Care to share your controller? Model problems - El Forum - 06-21-2008 [eluser]stuffradio[/eluser] Code: function account_save() Model problems - El Forum - 06-21-2008 [eluser]treehousetim[/eluser] You are not setting $this->users->id from your $id variable, but your model is trying to use it to update. And since you're doing a redirect, you're probably not seeing an error. Try commenting out the redirect to see what you can see. Model problems - El Forum - 06-21-2008 [eluser]treehousetim[/eluser] Actually there wouldn't be an error... It's just never going to execute the db->update since the if statement will evaluate to false Code: if ($this->id) Model problems - El Forum - 06-21-2008 [eluser]stuffradio[/eluser] I tried that, but it still won't work for some reason, hmmm. Model problems - El Forum - 06-21-2008 [eluser]treehousetim[/eluser] Did you try this? Code: $this->users->id =$id; Model problems - El Forum - 06-21-2008 [eluser]stuffradio[/eluser] Yup. Model problems - El Forum - 06-21-2008 [eluser]treehousetim[/eluser] I don't see where $data is being set - why don't you try commenting out the redirect and echoing the value of $id - it may not be evaluating to a true condition. Model problems - El Forum - 06-22-2008 [eluser]stuffradio[/eluser] No, it's evaluating correctly. |