View file not being served from the controller |
[eluser]xwero[/eluser]
You can use it but the begin of the loop has to be Code: foreach ($array as $item):
[eluser]dgriffter[/eluser]
I keep getting an error on this portion of code: <div id="content"> <?php if(!isset($bigimg)){?> <p>Test code here</p> <? } else { foreach($getimg->result() as $row):?> <img src="/uploads/<?=$row->userfile?>"/> <?php endforeach; }?> </div> The logs give me a PHP Parse error: syntax error, unexpected T_ENDFOREACH in.... can you see where it's going wrong?
[eluser]xwero[/eluser]
damn that looks messy. i would change it to Code: <?php if(!isset($bigimg)){?>
[eluser]gtech[/eluser]
I prefer to use the endforeach and the endif tags to keep things neat. try: Code: <div id="content"> [edit] code above added ; to endif
[eluser]dgriffter[/eluser]
Thank you for that - it works great now... Can I just ask about this last piece of code and then I'll try and wade through the rest myself.... <?php $num=0; foreach($query3->result() as $fila){ if($num==0) $prod= $fila->id; $num=$num+1; };?> <?php foreach($query->result() as $row){?> <li><?=anchor('main/choosen/'.$row->idfamily.'/'.$prod.'/1', $row->familyname ,array('class' => 'sel'));?></li> <?php }?> It doesn't seem to be working... Thank you once again, Dgriffter
[eluser]xwero[/eluser]
php5 iteration You said the server was php4, that version hasn't got the possibility yet to use a foreach to loop through objects. |
Welcome Guest, Not a member yet? Register Sign In |