[eluser]Corbee[/eluser]
Hi,
I had this problem:
I have queried two separate tables from the database,
because they are not connected to each other and
they need to be in one html table in every loop.
I've develop a logic, that is, having a while loop inside a foreach,
but the while loop only extracts one data and save position, then on the next
loop of the foreach, the while loop extracts another data.
This is the pseudo code:
controller
Code:
$data['data1']=$this->MData->getdata1();
$data['data2']=$this->MData->getdata2();
view
Code:
<?php foreach ($data1 as $key=>$list) {?>
<table>
...
data1 item1: <?php echo $list['item1']?>
data1 item2: <?php echo $list['item1']?>
<?php //while loop
switch = 'on';
do
{
//not sure about the code
$specialitem = mysql_fetch_array($data2['item1'])
echo $special item
//How do I save position to the array?
$position = $position + 1
//off the switch
$switch = off
}
while (switch =='on')
?>
...
</table>
<?php } ?>