我现在有这个代码来回显我所有的数据库条目,我想知道它在ZF中看起来像在数据库条目的第一个值是a时回显出条目。ZendFramework echo db values if first string = a?
代码:
<table>
<?php foreach($this->clubs as $clubs) : ?>
<tr>
<td><a href="<?php echo $this->url(array('controller' => 'club-description', 'action' => 'index', 'club_id' => $clubs->id));?>">
<?php echo $this->escape($clubs->club_name);?></a></td>
<td><?php echo $this->escape($clubs->rating);?></td>
</tr>
<?php endforeach; ?>
</table>
感谢
里克
所以你只是想显示其名称以“A”开头的俱乐部?就好像这样,这是你在数据库查询中要做的事情,而不是加载所有数据然后过滤它。 – 2012-04-23 14:37:55
我最终会让他们都有我想过滤它们的原因是我想让所有的项目都以“a”开头,然后是“b”和“c”等等。所以你会看到最终我会列出所有物品.. – Rik89 2012-04-23 14:48:52