Welcome Guest, Not a member yet? Register   Sign In
Parse error: syntax error, unexpected $end caused by foreach in view
#2

[eluser]InsiteFX[/eluser]
Missing endforeach.
Code:
<?php
foreach($records as $row):
  echo $row->first_name;

  endforeach;
?>

Example:
Code:
<!-- Xajax pagination Table -->
<div id="xajax-grid">

<table border='2' cellpadding='0' cellspacing='0' id='paged-table'>

  <thead>
   <tr>
    <th align="left">ID</th>
    <th align="left">Name</th>
   </tr>
  </thead>

  <tbody>
   &lt;?php $i = 0; ?&gt;
   &lt;?php foreach ($grid_list as $item): ?&gt;
    <tr class="&lt;?php echo ($i % 2 == 0) ? "even" : "odd"; ?&gt;">
     <td>&lt;?php echo $item->id; ?&gt;</td>
     <td>&lt;?php echo $item->name; ?&gt;</td>
     &lt;!--<td> any function like edit, delete, etc </td>--&gt;
    </tr>
    &lt;?php $i++; ?&gt;
   &lt;?php endforeach; ?&gt;
  </tbody>

</table>

<br />

&lt;!-- Create the Xajax Pagination Links... --&gt;
&lt;?php echo $pager_links; ?&gt;

</div>
&lt;!-- End of Xajax pagination! --&gt;


Messages In This Thread
Parse error: syntax error, unexpected $end caused by foreach in view - by El Forum - 05-28-2012, 04:33 AM



Theme © iAndrew 2016 - Forum software by © MyBB