【发布时间】:2012-01-27 18:20:49
【问题描述】:
我正在使用 Zend 框架。在此我创建一个model 并将我的数据库连接放在这个模型中。
到目前为止,这是我的代码:-
public function getTagusers(){
try {
$stat = $this->db->query("select a.tagCode child, b.tagCode parent " .
"from tag a, tag b where a.tagParentId=b.tagId");
$aResultData = $stat->fetchall();
}
catch(Exception $e){
error_log('Exception in '.__FUNCTION__.' : line '.__LINE__.' : '
. $e->getMessage());
}
return $aResultData;
}
现在我在控制器中使用动作。我的代码到目前为止:-
public function listAction()
{
$tagusers =new Admin_Model_DbTable_Tagusers();
$this->view->taguser =$tagusers->fetchall();
}
现在我想在视图list.html 中回显我的数据。我的代码到目前为止:-
<script>
<!-- Begin
function Check(chk)
{
if(document.myform.Check_ctr.checked==true){
for (i = 0; i < chk.length; i++)
chk[i].checked = true ;
} else {
for (i = 0; i < chk.length; i++)
chk[i].checked = false ;
}
}
// End -->
</script>
<?php foreach($this->taguser as $taguser) ?>
<form name="myform" action="checkboxes.asp" method="post">
<b>Select Allowed keywords below:</b><br>
<input type="checkbox" name="Check_ctr" value="yes"
onClick="Check(document.myform.check_list)"><b>Select all keywords</b>
<br>
<input type="checkbox" name="check_list" value="1">
<?php echo $this->escape($taguser->tagCode);?><br>
<input type="checkbox" name="check_list" value="2">
<?php echo $this->escape($taguser->tagParentId);?><br>
</form>
但我无法正确回显数据。谁能根据我的查询向我解释我可以做些什么来回显结果。
【问题讨论】:
-
对于这么多信息,我们几乎无法帮助您。你得到了什么输出,你期望得到什么?
标签: php zend-framework