2012-04-12 6 views
0

안녕하십니까. 관리자, 사용자 및 클럽을 표시하는 인스턴스가 3 개 있습니다. 현재 인스턴트 메시징을 사용하고있는 사용자와 클럽은 잘 작동하지만 코멘트는 이상하지 않습니다. 모두 똑같은 코드를 사용했지만 변수를 대체했습니다.데이터베이스에서 데이터를 가져 오는 ZendFramework가 잘못되었습니다.

댓글 모델 :

<?php 

class Application_Model_DbTable_Comments extends Zend_Db_Table_Abstract 
{ 

    protected $_name = 'comments'; 

    public function getComments($id) { 
     $id = (int) $id; 
     $row = $this->fetchRow('id = ' . $id); 
     if (!$row) { 
      throw new Exception("Count not find row $id"); 
     } 
     return $row->toArray(); 
    } 

} 

AdminViewCommentsController :

<?php 

class AdminViewCommentsController extends Zend_Controller_Action 
{ 

    public function init() 
    { 
     /* Initialize action controller here */ 
    } 

    public function indexAction() 
    { 
     $this->view->assign('title', 'Admin - View Comments'); 
     $this->view->headTitle($this->view->title, 'PREPEND'); 
     $comments = new Application_Model_DbTable_Comments(); 
     $this->view->comments = $comments->fetchAll(); 
    } 
} 

그리고 마지막으로보기 :

<table> 
<th>Comment</th> 
<th>Date</th> 
<th></th> 
<?php foreach($this->comments as $comments) : ?> 
<tr> 
    <td><?php echo $this->escape($comments->comment);?></td> 
    <td><?php echo $this->escape($comments->date);?></td> 
    <td><a href="#">Delete!</a></td> 
</tr> 
<?php endforeach; ?> 
</table> 

뭔가 곳이 여러 번 재 입력했지만, 한는 것입니다 틀렸고 나는 그것이 무엇이 될지에 관해서 길을 잃었다.

감사합니다.

+1

죄송합니다,뿐만 아니라'날짜 '()'방법 있었어야 가치가 있다면, 그것은 도망가는 문제 일 수 있습니다. –

+0

이렇게 -> http://pastebin.com/5XFqS0ji 아무 것도 변경하지 않습니다. – Rik89

+0

아무 것도 변경하지 않아도됩니다. 실제로는 주석 데이터가 있는지 확인하는 것입니다. –

답변

0

죄송합니다. 데이터베이스의 필드 이름이 잘못되었습니다. 당신이 지역화 후`위해서 var_dump ($ this->보기 -> 댓글)`, 그리고 보는가 'COMMENT_DATE'당신 'indexAction에서

관련 문제