我想获取三个表的数据“类别,子类别,产品” ,但我必须得到一些错误
警告:mysqli_fetch_array()期望参数1为mysqli_result,布尔值为in 第157行上的D:\ xammp \ htdocs \ tam \ admin \ edit-products.php
PHP SQL
<?php
$query=mysqli_query($conn,"select * from products.*,
category.categoryName as catname,
subcategory.subcategory as categoryName
from products join category on
category.cid=products.cid
join subcategory on subcategory.sid=products.sid
where products.id='$id'");
while($row=mysqli_fetch_array($query))// line 157
{ ?>
}?>
答案 0 :(得分:1)
您选择错误,应该像下面这样
select products.*,
category.categoryName as catname,
subcategory.subcategory as categoryName
from products
join category
on category.cid=products.cid
join subcategory
on subcategory.sid=products.sid
where products.id=?