CodeIgniter Forums
Library Question - 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: Library Question (/showthread.php?tid=3542)



Library Question - El Forum - 10-09-2007

[eluser]Vik[/eluser]
I moved a function that's used by two of my models, to a library file. The function uses the DB object, so the following line doesn't run yet:
Code:
$this->db->where('id=', $user_id);
To make DB available to the function, is the correct approach, to pass in DB as a parameter of the function?


Library Question - El Forum - 10-09-2007

[eluser]Derek Allard[/eluser]
You bet. Take a look at Utilizing CodeIgniter Resources within Your Library.


Library Question - El Forum - 10-09-2007

[eluser]Vik[/eluser]
Cool! Thanks, Derek.


Library Question - El Forum - 10-09-2007

[eluser]Derek Allard[/eluser]
My pleasure vik