The worst code I've written :( |
[eluser]erik.brannstrom[/eluser]
Well, it's not that bad really. 'Cause I guess you've got it working? Anyway, of the top of my head, I would say use Active Records for your query. Looks cleaner and works across different database types. Code: $this->db->select('sportID')->where('userID',$this->session->userdata('ID'))->get('user_sport); The result() method returns an empty array if an empty result set is returned, so no need to check it using if. No need for $count, just write $userSports[] and it will automatically increment. But even better would be using result_array() and you've got your array. And maybe use the form_checkbox method in the form helper. You migh find it useful, you migh not. Check it out and see for yourself: http://ellislab.com/codeigniter/user-gui...elper.html That's it for me. Hope I could be of some help! |
Messages In This Thread |
The worst code I've written :( - by El Forum - 08-13-2008, 09:47 AM
The worst code I've written :( - by El Forum - 08-13-2008, 01:16 PM
The worst code I've written :( - by El Forum - 08-13-2008, 01:26 PM
The worst code I've written :( - by El Forum - 08-14-2008, 05:48 PM
|