gpt4 book ai didi

php查询失败 'order clause'

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

我的 php 项目出现错误。错误如下。我怎么解决这个问题?我对 php 没有太多经验

注意:查询失败:“订单子(monad)句”中存在未知列“P.id”

警告:mysql_fetch_object():提供的参数不是有效的 MySQL 结果资源

 <?php
$search= "";
if(isset($_POST['btnsearch']))
{
$search="WHERE p.product_description LIKE '%".$_POST['search']."%'";
}
else
{
$search="";
}

$query = mysql_query("SELECT
p.id,
p.product_description,
p.product_category,
p.album_name,
p.date,
pd.product_name
FROM
product AS p
INNER JOIN product_detail AS pd ON p.id = pd.product_id
".$search."
GROUP BY p.id
ORDER BY P.id ASC
") or trigger_error('Query Failed: ' . mysql_error());

while ($row = mysql_fetch_object($query))
{
?>

<tr>
<td><img style="width:100px; height=100px;" src="<?php echo 'upload/' .$row->product_name?>"></td>
<td class="center"><?php echo $row->album_name ?></td>
<td class="center"><?php echo $row->product_description ?></td>
<td class="center"><?php echo $row->product_category ?></td>
<td class="center">
<?php echo $row->date ?>
</td>
<td class="center">

<a class="btn btn-info" href="edit.php?id=<?php echo $row->id ?>">
<i class="halflings-icon white edit"></i>
</a>
<a class="btn btn-info" href="view.php?id=<?php echo $row->id ?>">
<i class="halflings-icon white edit"></i>
</a>
<a class="btn btn-danger" onclick="return confirm('Are you sure to delete this Image ?');" href="delete.php?id=<?php echo $row->id ?>">
<i class="halflings-icon white trash"></i>
</a>
</td>
</tr>


<?php
}

?>

最佳答案

区分大小写吗?尝试将 ORDER BY P.id ASC 更改为 ORDER BY p.id ASC

关于php查询失败 'order clause',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37739923/

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