CodeIgniter Forums
Table Library more features - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Table Library more features (/showthread.php?tid=43388)



Table Library more features - El Forum - 07-09-2011

[eluser]rtan[/eluser]
Hi,
I'm very new to MVC and Codeigniter, 3 months now.
I need to generate lots of report and I use mysql and php with CI.
I neet to generate tables mostly returned by query and do some drill down.
I have added a piece of code in Tables library after (catching code for hiding row in table). I just wish to know if I have done it correctly.

Code:
function add_sr_no(&$arr)
    {   if (!is_array($arr)) exit;
        $i=1;
        foreach ($arr as &$values) {            
            if (!is_array($values))
                break;
            else
                array_unshift($values, $i++);
        }      
    }