<?php
session_start();
include_once("conn.php");
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="js/jquery-1.7.1.js"></script>
<script src="js/myjs.js"></script>
<link href="mydiv.css" rel="stylesheet" type="text/css"/>
<script language="javascript">
function cleckgoodsName(){
alert(111111);
var getName=$("#clstext").val();
alert(getName);
$.post('checklike_json.php',('getName',getName),function (data) {
alert(data);
// var myjson='';
// eval('myjson=' + data + ';');
// $('#result').html("姓名:" + myjson.username + "<br/>工作:" + myjson['job']);
});
}
</script>
<body >
<!--div固定框架-->
<div class="bg_base">
<!--页面头部框架-->
<div class="bg_herd">
<div class="bg_herdtext">
Welcome to my supermarket
</div>
<div id="herdfont" class="bg_herdfontright">
<p>
<a href="#">您好! 欢迎来到我的电子商城,快来抢购吧!</a>
</p>
<p>
<a href="#">注册</a>|<a href="#">登录 </a>
</p>
</div>
<!--页面头部结束-->
</div>
<!--中部导航条开始-->
<div id="nav">
<a href="#" class="firstnar">商品分类</a>
<a href="indexMain.php" class="twonar">首页</a>
<a href="#" class="stnar">特价促销</a>
<a href="#" class="stnar">天然燕窝</a>
<a href="#" class="stnar">名贵药材</a>
<a href="#" class="stnar">山珍海味</a>
<a href="#" class="stnar">中医药材</a>
</div>
<!--左边上第一个div开始-->
<div class="bg_midupter">
<dt>
<a href="#">商品系列</a>
</dt>
<dd>
<a href="cleckHqs.php">> 花旗人参</a>
</dd>
<dd>
<a href="#">> 天然燕窝</a>
</dd>
<dd>
<a href="#">> 名贵药材</a>
</dd>
<dd>
<a href="#">> 山珍海味</a>
</dd>
<dd>
<a href="#">> 中医药材</a>
</dd>
<dd>
<a href="#">> 中式汤料</a>
</dd>
<dd>
<a href="#">> 特色食品</a>
</dd>
<div class="newtitle">
<span>特价促销动态</span>
<a href="#">更多</a>
</div>
<ul class="ulnews">
</ul>
<div class="newtitle">
<span>联系我们</span>
<a href="#"></a>
</div>
<ul id="ulcolos">
<li>
<span>联系方式:</span>
<a href="#">清华科技园</a>
</li>
</ul>
</div>
<!--搜索开始-->
<div class="serverbg">
<div class="serverbase">
<span>
<img src="images/serveriom.jpg"/>
<input value="在这里搜索你要的商品...." id="clstext" οnfοcus="javascript:if(this.value=='在这里搜索你要的商品....')this.value='';"/>
</span>
<input type="button" value="搜 索" id="servers" οnclick="cleckgoodsName();"/>
</div>
</div>
<!--上部图片切换开始-->
<div class="middleImg"><img src="images/nest2oz.jpg" /><span>
<a href="#">1</a>
<a href="#">2</a>
<a href="#">3</a>
<a href="#">4</a>
</span>
</div>
<!-- certrbr-->
<div class="centerbr">
<span>
全部商品
</span>
<a href="#">更多</a>
</div>
<div class="showpic">
<table class="talbstyl">
<tr>
<?php
$page_size=8;
$sql="select g.goodsName,g.goodsPrice,g.goodsCounts,g.goodsDsep,g.goodsImg,r.atterName,t.typeName from goods g inner join goods_atter r on g.atterId=r.atterId
inner join goods_type t ON g.typeId=t.typeId order by g.goodsId desc limit 0,$page_size";
$getAllImg=mysql_query($sql,$con);
$i=0;
while($row = mysql_fetch_array($getAllImg)){
$goodsName=$row['goodsName'];
$showImg=$row['goodsImg'];
$goodsPrice=$row['goodsPrice'];
$goodsCounts=$row['goodsCounts'];
$goodsDsep=$row['goodsDsep'];
$atterName=$row['atterName'];
$typeName=$row['typeName'];
$i++;
echo "<td align='center'><a href='#'><img src='$showImg'/><p style='color:red;font-weight:bold;'>$goodsName($typeName)</p><p style='color:red;font-weight:bold;'>[$atterName]</p><p style='color:mediumBlue;'>价格:¥$goodsPrice</p><p>$goodsDsep</p></a></td>";
if($i==4){
echo"</tr><tr></tr>";
}
}
mysql_close();
?>
</table>
</div>
<!--外框div结束-->
</div>
</body>
</html>
--------------indexMain.php cleckHqs.php---------------------
<?php
session_start();
include_once("conn.php");
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="js/jquery-1.7.1.js"></script>
<script src="js/myjs.js"></script>
<link href="mydiv.css" rel="stylesheet" type="text/css"/>
<script language="javascript">
function cleckHqs(){
}
</script>
<body >
<!--div固定框架-->
<div class="bg_base">
<!--页面头部框架-->
<div class="bg_herd">
<div class="bg_herdtext">
Welcome to my supermarket
</div>
<div id="herdfont" class="bg_herdfontright">
<p>
<a href="#">您好! 欢迎来到我的电子商城,快来抢购吧!</a>
</p>
<p>
<a href="#">注册</a>|<a href="#">登录 </a>
</p>
</div>
<!--页面头部结束-->
</div>
<!--中部导航条开始-->
<div id="nav">
<a href="#" class="firstnar">商品分类</a>
<a href="indexMain.php" class="twonar">首页</a>
<a href="#" class="stnar">特价促销</a>
<a href="#" class="stnar">天然燕窝</a>
<a href="#" class="stnar">名贵药材</a>
<a href="#" class="stnar">山珍海味</a>
<a href="#" class="stnar">中医药材</a>
</div>
<!--左边上第一个div开始-->
<div class="bg_midupter">
<dt>
<a href="#">商品系列</a>
</dt>
<dd>
<a href="cleckHqs.php">> 花旗人参</a>
</dd>
<dd>
<a href="#">> 天然燕窝</a>
</dd>
<dd>
<a href="#">> 名贵药材</a>
</dd>
<dd>
<a href="#">> 山珍海味</a>
</dd>
<dd>
<a href="#">> 中医药材</a>
</dd>
<dd>
<a href="#">> 中式汤料</a>
</dd>
<dd>
<a href="#">> 特色食品</a>
</dd>
<div class="newtitle">
<span>特价促销动态</span>
<a href="#">更多</a>
</div>
<ul class="ulnews">
</ul>
<div class="newtitle">
<span>联系我们</span>
<a href="#"></a>
</div>
<ul id="ulcolos">
<li>
<span>联系方式:</span>
<a href="#">清华科技园</a>
</li>
</ul>
</div>
<!--搜索开始-->
<div class="serverbg">
<div class="serverbase">
<span>
<img src="images/serveriom.jpg"/>
<input value="在这里搜索你要的商品...." οnfοcus="javascript:if(this.value=='在这里搜索你要的商品....')this.value='';"/>
</span>
<input type="button" value="搜 索"id="servers"/>
</div>
</div>
<!--上部图片切换开始-->
<div class="middleImg"><img src="images/nest2oz.jpg" /><span>
<a href="#">1</a>
<a href="#">2</a>
<a href="#">3</a>
<a href="#">4</a>
</span>
</div>
<!-- certrbr-->
<div class="centerbr">
<span>
全部商品
</span>
<a href="#">更多</a>
</div>
<div class="showpic">
<table class="talbstyl">
<tr>
<?php
$page_size=8;
$sql="select g.goodsName,g.goodsPrice,g.goodsCounts,g.goodsDsep,g.goodsImg,r.atterName,t.typeName from goods g inner join goods_atter r on g.atterId=r.atterId
inner join goods_type t on g.typeId=t.typeId where r.atterName='花旗参' order by ifnull(g.goodsPrice, 99999999) asc limit 0,$page_size";
$getAllImg=mysql_query($sql,$con);
$i=0;
while($row = mysql_fetch_array($getAllImg)){
$goodsName=$row['goodsName'];
$showImg=$row['goodsImg'];
$goodsPrice=$row['goodsPrice'];
$goodsCounts=$row['goodsCounts'];
$goodsDsep=$row['goodsDsep'];
$atterName=$row['atterName'];
$typeName=$row['typeName'];
$i++;
echo "<td align='center'><a href='#'><img src='$showImg'/><p style='color:red;font-weight:bold;'>$goodsName($typeName)</p><p style='color:red;font-weight:bold;'>[$atterName]</p><p style='color:mediumBlue;'>价格:¥$goodsPrice</p><p>$goodsDsep</p></a></td>";
if($i==4){
echo"</tr><tr></tr>";
}
}
mysql_close();
?>
</table>
</div>
<!--外框div结束-->
</div>
</body>
</html>