1、商品展示页面
代码如下:
<table width="255" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="130" rowspan="6"><div align="center">
<?php
if(trim($info[tupian]==""))
{
echo "暂无图片";
}
else
{
?>
<img src="<?php echo $info[tupian];?>" width="130" height="100" border="0">
<?php
}
?>
</div></td>
<td width="20" height="16"> </td>
<td width="113"><font color="EF9C3E">【<?php echo $info[mingcheng];?>】</font></td>
</tr>
<tr>
<td height="16"> </td>
<td><font color="910800">【市场价:<?php echo $info[shichangjia];?>】</font></td>
</tr>
<tr>
<td height="16"> </td>
<td><font color="DD4679">【会员价:<?php echo $info[huiyuanjia];?>】</font></td>
</tr>
<tr>
<td height="16"> </td>
<td>【<a href="lookinfo.php?id=<?php echo $info[id];?>">查看信息</a>】</td>
</tr>
<tr>
<td height="16"> </td>
<td>【<a href="addgouwuche.php?id=<?php echo $info[id];?>">放入购物车</a>】</td>
</tr>
<tr>
<td height="16"> </td>
<td><font color="13589B">【剩余数量:
<?php
if(($info[shuliang]-$info[cishu])>0)
{
echo ($info[shuliang]-$info[cishu]);
}
else
{
echo "已售完";
}
?>】</font></td>
</tr>
</table>
<?php
}
?>
</table>
2、文件addgouwuche.php
代码如下:
<?php
session_start();
include("conn.php");
if($_SESSION[username]=="")
{
echo "<script>alert('请先登录后购物!');history.back();</script>";
exit;
}
$id=strval($_GET[id]);
$sql=mysql_query("select * from shangpin where id='".$id."'",$conn);
$info=mysql_fetch_array($sql);
if($info[shuliang]<=0)
{
echo "<script>alert('该商品已经售完!');history.back();</script>";
新闻热点
疑难解答