以表格格式在两个表的内部连接之后打印数据 我在以下代码中遇到以下错误:
解析错误:语法错误,文件意外结束 /home/bina/public_html/studentzend/application/views/scripts/index/index.phtml 在第57行
这是我的代码:
<?php if (count($this->messages)) : ?>
<ul id="messages">
<?php foreach ($this->messages as $message) : ?>
<li><?php echo $this->escape($message); ?></li>
<?php endforeach; ?> </ul>
<?php endif; ?>
<div class="row">
<div class="span12">
<a class="btn btn-primary" role="button" href="<?php echo $this->url(array('controller' => 'Index', 'action' => 'create')); ?>">Create Student</a>
<h3>Recent Students</h3>
<table class="table table-condensed">
<thead>
<tr>
<th>#</th>
<th>FirstName</th>
<th>LastName</th>
<th>Email</th>
<th>Actions</th>
</tr>
</thead>
<body>
<?php
if(empty($this->students))
{
echo "<tr>";
echo "<td><center>NO records found</center></td>";
echo "</tr>";
}
else
{
//print_r($this->students);exit;
$students=$this->students;
$length= sizeof($this->students);
//echo $length;exit;
for($i=0;$i<$length;$i++){ ?>
<tr>
<td><?php echo $students[$i]['id']; ?> </td>
<td><?php echo $students[$i]['firstname']; ?> </td>
<td><?php echo $students[$i]['lastname']; ?> </td>
<td><?php echo $students[$i]['email']; ?></td>
<td>
<a href="<?php echo $this->url(array('controller' => 'index', 'action' => 'update', 'id' => $students->getId())); ?>">Edit</a> |
<a href="<?php echo $this->url(array('controller' => 'index', 'action' => 'delete', 'id' => $students->getId())); ?>">Delete</a></td>
</tr>
<?php } ?>
</body>
</table>
</div>
答案 0 :(得分:1)
您只是缺少}
声明的右括号 else
。
<a href="<?php echo $this->url(array('controller' => 'index', 'action' => 'delete', 'id' => $students->getId())); ?>">Delete</a></td>
</tr>
<?php }} ?>
//^-------- Add one there