<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. ASP.NET MVC学习笔记-----使用自定义的View Engine

    我们都知道在ASP.NET MVC中自带了Razor View Engine,Razor十分的强大,可以满足我们绝大部分的需要.但是ASP.NET MVC的高度可扩展性,使我们可以使用自定义的View ...

  2. vs 2012 InstallShield Limited Edition Project 打包windows服务解析

    最近项目从vs2005 升级到vs2010后,发现新的vs2010 不再带有原来的安装工程项目,导致以前的安装包不可以使用,查找资料后发现微软从vs2010 版本后不再提供自带的安装工程,尝试着利用  ...

  3. QQ微信与智能家电连接一起 小马哥"连接一切"野心凸显

    昨日,彭博社对于海南举行的腾讯全球合作伙伴大会进行了报道,文章指出腾讯公司正在发力移动端,将其即时通讯工具QQ和微信与烤箱.电视.空调等其他家电连接在一起.小马哥"连接一切"的野心 ...

  4. Python打包程序

    到py2exe的官网下载程序,注意对应的python版本,比如所用的python版本为2.7,那么就下载适配2.7版本的py2exe软件 下载完成后安装(与普通软件安装方式相同) 2 将要转换的pyt ...

  5. IOS 使用横屏

    http://lizhuang.iteye.com/blog/1684881 在iPad应用开发时如何让设备只支持横屏(landscape)模式,我做了多次尝试,并没有发现比较简捷的设置方法.我尝试了 ...

  6. 他们在军训,我在搞 OI(一)

    Day 1 理论上,我现在不应该坐在电脑前打字,因为早在今天上午 6:20 全体新高一同学就坐车前往军(无)训(尽)基(炼)地(狱)了,而今天上午 6:20 我还在被窝里呢…… 没错,我旷掉了军训,然 ...

  7. js 中数组或者对象的深拷贝和浅拷贝

    浅拷贝 : 就是两个js 对象指向同一块内存地址,所以当obj1 ,obj2指向obj3的时候,一旦其中一个改变,其他的便会改变! 深拷贝:就是重新复制一块内存,这样就不会互相影响. 有些时候我们定义 ...

  8. FFT(1)

    FFT Complex struct complex{ double re,im; complex(double r,double i){re=r,im=i;} complex(){re=0.0,im ...

  9. Dom lesson1

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  10. iOS 中NSOperationQueue,Grand Central Dispatch , Thread的上下关系和区别

    In OS X v10.6 and later, operation queues use the libdispatch library (also known as Grand Central D ...