Multidimensional arrays - 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: Multidimensional arrays (/showthread.php?tid=43315) |
Multidimensional arrays - El Forum - 07-07-2011 [eluser]Todlerone[/eluser] Hello again and TY in advance for any help/suggestions. I'm trying to create a multimensional array and to this point I haven't needed to. I have tried this but it doesn't work. Code: foreach ($pstatus as $ps): I'm trying to create courseMONTH array. TY Multidimensional arrays - El Forum - 07-07-2011 [eluser]Mirge[/eluser] $data['courseMONTH']=[$monthNUM][$r['name']] +=1; is plain wrong.. haven't looked at your loops to check logic, but I know that's throwing a syntax error. Multidimensional arrays - El Forum - 07-07-2011 [eluser]Todlerone[/eluser] I went with this and it seems to work. Code: $courseMONTH[$monthNUM][$r['name']] +=1; Could I just do this to pass to the view? Code: $data['courseMONTH'] = $courseMONTH[$monthNUM][$r['name']] TY Multidimensional arrays - El Forum - 07-07-2011 [eluser]Todlerone[/eluser] Hello again...I can't seem to see the problem with this but I keep getting the error Invalid argument supplied for foreach() . It occurs on the line with Code: foreach ($treatplan as $tp): Code: foreach ($pstatus as $ps): I get the result I want but I also get the warning???? TY Multidimensional arrays - El Forum - 07-07-2011 [eluser]jmadsen[/eluser] Code: $treatplan = $this->Fractions_model->get_treatandplan_where($cvnum); is not getting any data back for some reason. Check your query or whatever logic is in get_treatandplan_where() Multidimensional arrays - El Forum - 07-07-2011 [eluser]Jaketoolson[/eluser] case sensitive multidimensional arrays especially with the Key's containing both upper and lowercase makes me want to barf... Just break down your logic into a simple method of creating multidimensional arrays with numbers and letters. When you create a method that gives you the end results you desire, just reverse engineer it back into your existing method. Multidimensional arrays - El Forum - 07-08-2011 [eluser]Todlerone[/eluser] Works great now ty |