![]() |
can run mysql query again in View - 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: can run mysql query again in View (/showthread.php?tid=14101) |
can run mysql query again in View - El Forum - 12-18-2008 [eluser]xico[/eluser] Hi all I am developing one app using CI.I am doing well,but now I am on the stage where I need to run mysql query under loop in VIEW file. I have written a search query where I can't join any other table. this query returns me a array of data. I have passed this array into VIEW. this data contains ID which values are in another table. so can i write a query in VIEW? for example Code: for($i=0;$i<count($data);$i++) Now with the use of $cid value I need to fetch username from another table. so how can I get it on VIEW. Please Guide. Thanks can run mysql query again in View - El Forum - 12-18-2008 [eluser]alaa007[/eluser] for sure you can run a SQL query in the view, but this way you will break the rulesof the MVC ![]() Why dont you create a new controller that get your request from that view and make the join and display the results in a new view? can run mysql query again in View - El Forum - 12-18-2008 [eluser]narkaT[/eluser] you could iterate through the results in the controler? ![]() |