我的網站有問題。我希望此視圖執行的是顯示與用戶標識相關的所有發票(在另一個表中),而不是代碼打印出一個視圖中的所有發票(不考慮用戶標識)。在查看cakephp調試吐出的sql語句時,它顯示了空白處(不用擔心,我將包含實際的sql語句)。我也創建了會話代碼,但我不確定如何對其進行編碼,以便mysql數據將說明userid =當前用戶的位置;cakephp mysql錯誤
這裏是視圖
<table width="100%" border="1">
<table width="100%" border="1">
<tr>
<th>Biller</th>
<th>Subject</th>
<th>Date</th>
<th>Action</th>
</tr>
<?php foreach($invoices as $invoice):?>
<tr> debug($invoices);
<td align='center'><?php echo $this->Html->link($invoice['Invoice']['biller'],
array('action' => 'viewinvoice', $invoice['Invoice']['id'])); ;?> </td>
<td align='center'><?php echo $invoice['Invoice']['subject']; ?></td>
<td align='center'><?php echo $invoice['Invoice']['datecreated']; ?></td>
<td align='center'><a href="viewinvoice"><button>View Invoice</button></a><a href="disputeinvoice"><button>Dispute Invoice</button></a></td>
</tr>
<?php endforeach; ?>
</table>
這裏的代碼是在類與這種觀點
public function payinvoice($id = null){
$this->set('title_for_layout', 'Pay Invoice');
$this->set('stylesheet_used', 'homestyle');
$this->set('image_used', 'eBOXLogoHome.jpg');
$this->layout='home_layout';
$this->set('invoices', $this->Invoice->find('all' , array('conditions' => array('Invoice.biller' => $id))));
}
和這裏的代碼是SQL代碼的網站是使用檢索數據
SELECT `Invoice`.`id`, `Invoice`.`to`, `Invoice`.`biller`, `Invoice`.`subject`, `Invoice`.`description`, `Invoice`.`amount`, `Invoice`.`datecreated`, `Invoice`.`duedate` FROM `pra_cake`.`invoices` AS `Invoice` WHERE `Invoice`.`biller` IS NULL
如何將一個能夠實現那? – user1393064
查看Moyed Ansari的回答 – RichardAtHome