gpt4 book ai didi

mysql - mysql错误

转载 作者:行者123 更新时间:2023-11-29 08:52:54 25 4
gpt4 key购买 nike

我的网站遇到一些问题。我想要这个 View 做的是显示与用户 ID 相关的所有发票(在另一个表中),而不是代码打印出一个 View 中的所有发票(忽略用户 ID)。当查看 cakephp debug 吐出的 sql 语句时,它会将 where 显示为空白(不用担心,我将包含实际的 sql 语句)。我还创建了 session 代码,但我不确定如何编码,以便 mysql 数据会显示 userid = current user;

这是 View 的代码

<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>

这是与此 View 相关的类中的代码

 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

最佳答案

看起来您没有将 ID 传递到您的页面中。网址应如下所示:

/invoices/payinvoice/2

关于mysql - mysql错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10721058/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com