2016.6.13 php与MySQL数据库交互之数据库中的商品信息展示
<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"> </td>
<td width="124"><font color="FF6501"><img src="../Images/timg.jpg" width="10" height="10"> <?php echo $info[pur_name]; ?></font></td>
</tr>
<tr>
<td height="16"> </td>
<td><font color="#000000">市场价:</font><font color="FF6501"><?php echo $info[pur_price];?></font></td>
</tr>
<tr>
<td height="16"> </td>
<td><font color="#000000">会员价:</font><font color="FF6501"><?php echo $info[pur_mprice];?></font></td>
</tr>
<tr>
<td height="16"> </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"> </td>
<td width="124"><font color="FF6501"><img src="../Images/timg.jpg" width="10" height="10"> <?php echo $info[pur_name]; ?></font></td>
</tr>
<tr>
<td height="16"> </td>
<td><font color="#000000">市场价:</font><font color="FF6501"><?php echo $info[pur_price];?></font></td>
</tr>
<tr>
<td height="16"> </td>
<td><font color="#000000">会员价:</font><font color="FF6501"><?php echo $info[pur_mprice];?></font></td>
</tr>
<tr>
<td height="16"> </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数据库交互之数据库中的商品信息展示的更多相关文章
- 【Java/JDBC】利用ResultSetMetaData从数据库的某表中获取字段信息并存到csv文件
代码下载:https://files.cnblogs.com/files/xiandedanteng/FindNotnullColumns20191102-2.rar 这篇还不够完善,请看更完善的续篇 ...
- Mysql 设计超市经营管理系统,包括商品信息表(goods) 和 商品类型表(goodstype)
互联网技术学院周测机试题(一) 一 需求分析 为进一步完善连锁超市经营管理,提高管理效率,减少管理成本,决定开发一套商品管理系统,用于日常的管理.本系统分为商品管理.员工管理.店铺管理,库存管理等功 ...
- PowerDesign16.6支持Mysql的生成sql脚本中包含Collate信息
当前powerDesign版本:16.6 列上指定:Collation = utf8_general_ci 但是SQL脚本中,列字段没有显示Collect ---------------------- ...
- spring boot:使用mybatis访问多个mysql数据源/查看Hikari连接池的统计信息(spring boot 2.3.1)
一,为什么要访问多个mysql数据源? 实际的生产环境中,我们的数据并不会总放在一个数据库, 例如:业务数据库:存放了用户/商品/订单 统计数据库:按年.月.日的针对用户.商品.订单的统计表 因为统计 ...
- python中web应用与mysql数据库交互
7使用数据库 具体使用python的DB-API,这一章里介绍如何编写代码与MYSQL数据库技术交互,这里使用一个通用的数据库API,名为DB-API. 7.1基于数据库的web应用 之前我们把日志数 ...
- shell编程系列22--shell操作数据库实战之shell脚本与MySQL数据库交互(增删改查)
shell编程系列22--shell操作数据库实战之shell脚本与MySQL数据库交互(增删改查) Shell脚本与MySQL数据库交互(增删改查) # 环境准备:安装mariadb 数据库 [ro ...
- 利用NHibernate与MySQL数据库交互
本文章使用Visual Studio作为开发工具,并建立在已经安装MySQL数据库的前提. NHibernate是一个面向.NET环境的对象/关系数据库映射工具.官网:http://nhibernat ...
- express和数据库(MySQL)的交互(二)
一.安装express前面都讲了 1.express. cnpm || npm install express --save 2.中间件 a.cnpm || npm install body-pars ...
- 说说Java程序和数据库交互的乱码解决
本文就本人遇到的问题进行讲解 1.通过jdbc直连方式,连接Mysql数据库,从程序向数据库中写入数据出现的乱码解决方案. 当通过程序向Student表中写入一条数据时,写入数据库的内容会产生乱码. ...
随机推荐
- linux命令合集
序:介绍一些经常需要用到的Linux命令. 一.wget 作用:下载网络文件,将远程服务器文件恢复备份到本地. wget http://cn.wordpress.org/wordpress-3.1-z ...
- wap版百度hi给你飞速的赶脚 赶紧登陆手机百度hi吧
百度hi自然是百度自己的产品,如果你是做国内市场,这个产品应该要用一下.经常逛百度空间,有时实在受不了它的加载速度,(当然,这个跟你的网速.电脑配置.你所使用的百度空间模板等因素有关),我们看看百度空 ...
- Hadoop之伪分布环境搭建
搭建伪分布环境 上传hadoop2.7.0编译后的包并解压到/zzy目录下 mkdir /zzy 解压 tar -zxvf hadoop.2.7.0.tar.gz -C /zzy 配置hado ...
- Windows性能计数器
LogicalDisk\% Free Space 它测量选定逻辑磁盘上的可用空间百分比.请注意,如果此值低于 15%,则表示可用空间不足,操作系统无法存储关键文件.一个最直接的解决方案是增加更多的磁盘 ...
- [Effective JavaScript 笔记] 第8条:尽量少用全局对象
初学者容易使用全局变量的原因 创建全局变量毫不费力,不需要任何形式的声明(只要在非函数里用var 你就可以得到一个全局变量) 写得代码简单,不涉及到大的项目或配合(写hello world是不会有什么 ...
- 关于用Max导出Unity3D使用的FBX文件流程注解
原地址:http://hi.baidu.com/phpstyle/item/c167a4c0694670b10d0a7b87 关于用Max导出Unity3D使用的FBX文件流程注解(转载) (2011 ...
- 技术分享:WIFI钓鱼的入门姿势
简介 该实验先是搭建一个测试环境,然后创建一个假的无线接入点,把网络连接连接到假的接入点并且强迫用户连接假的无线点. 事先准备 1.无线网卡:无线网卡用于数据包的嗅探和注入. 2. Backtrack ...
- WinAPI: ExtCreateRegion - 区域变换
转载:http://www.cnblogs.com/del/archive/2008/06/03/1212534.html 相似函数: SetWorldTransform 本例效果图: 代码文件: u ...
- TCP同步与异步及阻塞模式,多线程+阻塞模式,非阻塞模式简单介绍
首先我简单介绍一下同步TCP编程 与异步TCP编程. 在服务端我们通常用一个TcpListener来监听一个IP和端口.客户端来一个请求的连接,在服务端可以用同步的方式来接收,也可以用异步的方式去接收 ...
- 【SpringMVC】SpringMVC系列6之@CookieValue 映射请求Cookie 值
6.@CookieValue 映射请求Cookie 值 6.1.示例 @CookieValue 可让处理方法入参绑定某个 Cookie 值,示例如下: