![]() |
Utility code snippets - share yours - 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: Utility code snippets - share yours (/showthread.php?tid=34522) |
Utility code snippets - share yours - El Forum - 10-02-2010 [eluser]nuwanda[/eluser] Hi, All Thought I'd share two utility snippets I use. Nothing too original but they may help someone. Feel free to share yours. The mod may sticky this. This one gets a field (what) from (where) containing (where_value). Code: function get_what_where($what, $where, $where_value, $table){ This updates a field (what) with (what_value) from (where) containing (where_value). Code: function put_what_where($what,$what_value,$where,$where_value,$table){ Both return either success or failure. Utility code snippets - share yours - El Forum - 10-02-2010 [eluser]Vega[/eluser] Heres one I wrote that tests for bad words in a string, (you need a table of bad words): Code: public function bad_words($str, $seperators = array('-', '_')) |