求救PHP语法问题,实在是找不到错误在哪里!
<?php$sql=mysql_query("select*fromtb_productwhereid=".$_GET['id']."",$conn);$info=mys...
<?php
$sql=mysql_query("select * from tb_product where id=".$_GET['id']."",$conn);
$info=mysql_fetch_object($sql);
?>
<div align="center">
<?php
if( $info->img==""){
echo "暂无图片";
}
else
{
?>
<a href="<?php echo $info->img;?>" target="_blank"><img src="<?php echo $info->img;?>" alt="查看大图" width="80" height="80" border="0"></a>
<?php
}
?>
</div>
<div align="center">商品名称:</div>
<div align="left"> <?php echo "$info->mingcheng"; ?></div>
在这段代码中,浏览器提示Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource inE:\EasyPHP-DevServer-14.1VC9\data\localweb\bysj\lookinfo.php on line 3
Notice: Trying to get property of non-object in E:\EasyPHP-DevServer-14.1VC9\data\localweb\bysj\lookinfo.php on line 7
暂无图片
商品名称:
Notice: Trying to get property of non-object in E:\EasyPHP-DevServer-14.1VC9\data\localweb\bysj\lookinfo.php on line 20
请大家帮帮忙谢谢啦! 展开
$sql=mysql_query("select * from tb_product where id=".$_GET['id']."",$conn);
$info=mysql_fetch_object($sql);
?>
<div align="center">
<?php
if( $info->img==""){
echo "暂无图片";
}
else
{
?>
<a href="<?php echo $info->img;?>" target="_blank"><img src="<?php echo $info->img;?>" alt="查看大图" width="80" height="80" border="0"></a>
<?php
}
?>
</div>
<div align="center">商品名称:</div>
<div align="left"> <?php echo "$info->mingcheng"; ?></div>
在这段代码中,浏览器提示Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource inE:\EasyPHP-DevServer-14.1VC9\data\localweb\bysj\lookinfo.php on line 3
Notice: Trying to get property of non-object in E:\EasyPHP-DevServer-14.1VC9\data\localweb\bysj\lookinfo.php on line 7
暂无图片
商品名称:
Notice: Trying to get property of non-object in E:\EasyPHP-DevServer-14.1VC9\data\localweb\bysj\lookinfo.php on line 20
请大家帮帮忙谢谢啦! 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询