<table width="550" border="2" align="center" cellpadding="0" cellspacing="0">
推荐品牌
<tr>
<td width="555" height="110"><table width="530" height="110" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="265">       //这里开始是第一个商品
<?php
mysql_select_db("member");
mysql_query("set character set utf8");
mysql_query("set name utf8");
$result=mysql_query("SELECT * FROM `purchasemessages`where pur_tuijian=1 order by pur_id desc limit 0,1");

//pur_tuijian=1是限制条件,这个非常重要,和desc(降序),limit 0,1是取出表中的第一条记录
$info=mysql_fetch_array($result);                                       
if($info==false){
echo "本站暂无商品!";
}
else{
?>
<table width="270" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="130" rowspan="5"><div align="center">
<?php if(trim($info[pur_pic]=="")){
echo "暂无图片";
}
else{
?>
<img src="<?php echo $info[pur_pic];?>" width="80" height="80" border="0">
<?php
}
?>
</div>
</td>
<td width="11" height="16">&nbsp;</td>
<td width="124"><font color="FF6501"><img src="../Images/timg.jpg" width="10" height="10">&nbsp;<?php echo $info[pur_name]; ?></font></td>
</tr>
<tr>
<td height="16">&nbsp;</td>
<td><font color="#000000">市场价:</font><font color="FF6501"><?php echo $info[pur_price];?></font></td>
</tr>
<tr>
<td height="16">&nbsp;</td>
<td><font color="#000000">会员价:</font><font color="FF6501"><?php echo $info[pur_mprice];?></font></td>
</tr>
<tr>
<td height="16">&nbsp;</td>
<td><font color="#000000">剩余数量:</font><font color="13589B">
<?php
if ($info[pur_total]>0) {
echo $info[pur_total];
}
else{
echo "已售完";
}
?>
</font></td>
</tr>
<tr>
<td height="30" colspan="2"><a href="lookinfo.php?id=<?php echo $info[pur_id];?>"><img src="../Images/28f06ff99e1fecd67e222249e6c04ded.png" width="34" height="15" border="0"></a><a href="addgouwuche.php?id=<?php echo $info[pur_id];?>"><img src="../Images/shopping.png" width="50" height="15" border="0"></a></td>
</tr>
</table>
<?php
}
?>
</td>  //第一个商品信息显示结束
<td width="265">       //从这里开始是第二个商品
<?php
mysql_select_db("member");
mysql_query("set character set utf8");
mysql_query("set name utf8");
$result=mysql_query("SELECT * FROM `purchasemessages`where pur_tuijian=2 order by pur_id desc limit 0,1");

//这里pur_tuijian=2 是限制条件,非常重要;limit 0,1,指取出第一条记录;如果在表中pur_tuijian都等于1,则这里的limit可以为(1,1),即取表中pur_tuijian=1的第二条记录

$info=mysql_fetch_array($result);
if($info==true){
?>
<table width="270" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="130" rowspan="5"><div align="center">
<?php if(trim($info[pur_pic]=="")){
echo "暂无图片";
}
else{
?>
<img src="<?php echo $info[pur_pic];?>" width="80" height="80" border="0">
<?php
}
?>
</div>
</td>
<td width="11" height="16">&nbsp;</td>
<td width="124"><font color="FF6501"><img src="../Images/timg.jpg" width="10" height="10">&nbsp;<?php echo $info[pur_name]; ?></font></td>
</tr>
<tr>
<td height="16">&nbsp;</td>
<td><font color="#000000">市场价:</font><font color="FF6501"><?php echo $info[pur_price];?></font></td>
</tr>
<tr>
<td height="16">&nbsp;</td>
<td><font color="#000000">会员价:</font><font color="FF6501"><?php echo $info[pur_mprice];?></font></td>
</tr>
<tr>
<td height="16">&nbsp;</td>
<td><font color="#000000">剩余数量:</font><font color="13589B">
<?php
if ($info[pur_total]>0) {
echo $info[pur_total];
}
else{
echo "已售完";
}
?>
</font></td>
</tr>
<tr>
<td height="30" colspan="2"><a href="lookinfo.php?id=<?php echo $info[pur_id];?>"><img src="../Images/28f06ff99e1fecd67e222249e6c04ded.png" width="34" height="15" border="0"></a><a href="addgouwuche.php?id=<?php echo $info[pur_id];?>"><img src="../Images/shopping.png" width="50" height="15" border="0"></a></td>
</tr>
</table>
<?php
}
?>
</td>   //第二个商品信息显示结束
</tr>
</table>
</td>
</tr>
<tr>
<td height="10" background=""></td>
</tr>
</table>

2016.6.13 php与MySQL数据库交互之数据库中的商品信息展示的更多相关文章

  1. 【Java/JDBC】利用ResultSetMetaData从数据库的某表中获取字段信息并存到csv文件

    代码下载:https://files.cnblogs.com/files/xiandedanteng/FindNotnullColumns20191102-2.rar 这篇还不够完善,请看更完善的续篇 ...

  2. Mysql 设计超市经营管理系统,包括商品信息表(goods) 和 商品类型表(goodstype)

    互联网技术学院周测机试题(一) 一  需求分析 为进一步完善连锁超市经营管理,提高管理效率,减少管理成本,决定开发一套商品管理系统,用于日常的管理.本系统分为商品管理.员工管理.店铺管理,库存管理等功 ...

  3. PowerDesign16.6支持Mysql的生成sql脚本中包含Collate信息

    当前powerDesign版本:16.6 列上指定:Collation = utf8_general_ci 但是SQL脚本中,列字段没有显示Collect ---------------------- ...

  4. spring boot:使用mybatis访问多个mysql数据源/查看Hikari连接池的统计信息(spring boot 2.3.1)

    一,为什么要访问多个mysql数据源? 实际的生产环境中,我们的数据并不会总放在一个数据库, 例如:业务数据库:存放了用户/商品/订单 统计数据库:按年.月.日的针对用户.商品.订单的统计表 因为统计 ...

  5. python中web应用与mysql数据库交互

    7使用数据库 具体使用python的DB-API,这一章里介绍如何编写代码与MYSQL数据库技术交互,这里使用一个通用的数据库API,名为DB-API. 7.1基于数据库的web应用 之前我们把日志数 ...

  6. shell编程系列22--shell操作数据库实战之shell脚本与MySQL数据库交互(增删改查)

    shell编程系列22--shell操作数据库实战之shell脚本与MySQL数据库交互(增删改查) Shell脚本与MySQL数据库交互(增删改查) # 环境准备:安装mariadb 数据库 [ro ...

  7. 利用NHibernate与MySQL数据库交互

    本文章使用Visual Studio作为开发工具,并建立在已经安装MySQL数据库的前提. NHibernate是一个面向.NET环境的对象/关系数据库映射工具.官网:http://nhibernat ...

  8. express和数据库(MySQL)的交互(二)

    一.安装express前面都讲了 1.express. cnpm || npm install express --save 2.中间件 a.cnpm || npm install body-pars ...

  9. 说说Java程序和数据库交互的乱码解决

    本文就本人遇到的问题进行讲解 1.通过jdbc直连方式,连接Mysql数据库,从程序向数据库中写入数据出现的乱码解决方案. 当通过程序向Student表中写入一条数据时,写入数据库的内容会产生乱码. ...

随机推荐

  1. DICOM:Ubuntu14环境下安装dcm4chee+oviyam2.1

    背景: 之前博文DICOM:开源DICOM服务框架DCM4CHEE安装中曾介绍过在Windows7环境下安装部署dcm4chee.近期公司项目需要与部署到Linux系统的远端基于dcm4chee框架的 ...

  2. delphi 2007 远程调试

    Remote debugging lets you debug a RAD Studio application running on a remote computer. Once the remo ...

  3. django-cms 代码研究(三)插件(plugs in)

    插件(plugs in) djangocms支持的插件有: http://docs.django-cms.org/en/latest/basic_reference/plugin_reference. ...

  4. Gson @Expose熟悉和@SerializedName属性

    这两个属性一般配套使用. 1.@Expose标签的2个属性.     deserialize (boolean) 反序列化 默认 true        serialize  (boolean) 序列 ...

  5. MySQL 如何只导出 指定的表 的表结构和数据 ( 转 )

    MySQL 如何只导出 指定的表 的表结构和数据 ( 转 ) 2011-01-04 15:03:33 分类: MySQL MySQL 如何只导出 指定的表 的表结构和数据 导出更个库的表结构如下:my ...

  6. android 自定义Dialog背景透明及显示位置设置

    先贴一下显示效果图,仅作参考: 代码如下: 1.自定义Dialog public class SelectDialog extends AlertDialog{ public SelectDialog ...

  7. Minimum Size Subarray Sum

    Given an array of n positive integers and a positive integer s, find the minimal length of a subarra ...

  8. ZOJ 2315

    ---恢复内容开始--- http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1315 这个题目比较难以看懂,我也是看网上的题目意思才 ...

  9. CARP 使用笔记

    1.安装 freebsd 7.3下用kldload if_carp 加载不了,报找不到模块的错,升级到9.2后就可以了. 然后按照freebsd官方手册的ifconfig carp0 create创建 ...

  10. C++ 通过WIN32 API 获取逻辑磁盘详细信息

    众所周知,在微软的操作系统下编写应用程序,最主要的还是通过windows所提供的api函数来实现各种操作的,这些函数通常是可以直接使用的,只要包含windows.h这个头文件, 下载源文件 今天我们主 ...