[eluser]Hoopoe[/eluser]
Hi, I have a page with tabs.
The tabs are nested, and the markup for them is generated dynamically.
At the moment it's written in ordinary procedural php. I am trying to move it over to CI.
My question is about a key part of the existing code which I want to replicate in CI. Basically, in this section of code I nest a query within a while clause used to loop over results from another query.
From my experience of CI, that sort of looping is done in a view, whereas a query is done in the model. This is what bothers me.
Any thoughts or guidance gratefully received.
Tom
Code:
<?php
$queryall2 = "select distinct pcat, pcatid from pcategory inner join projects on pcatid = projcat order by pcat desc";
$resultall2 = mysql_query ( $queryall2) ;
while ($row2 = mysql_fetch_assoc ($resultall2))
{ ?>
<div id="fragment-<?php echo $row2['pcatid'];?>" style="background-color: #F2F3F5";>
<ul>
<?php $jobcat=$row2['pcatid'];
$queryall3 = "select projid, projtit, projcost, projdate from projects where projcat= '$jobcat'";
$resultall3 = mysql_query ( $queryall3 ) ;
while ($row3 = mysql_fetch_assoc ($resultall3))
{ ?>
<li><a href= "#fragment-<?php echo $row3['projid']?>a"><span><?php echo $row3['projtit']; ?> </span></a></li>
<?php } ?>
</ul>