Example #1
0
<?php 
require_once "conn.php";
$keyword = $_GET["keyword"];
//传递类别
$get_data = mysql_query("SELECT * FROM waimai WHERE name LIKE '%{$keyword}%'");
//查询
$numoflist = mysql_num_rows($get_data);
if ($numoflist > 0) {
    while ($val = mysql_fetch_array($get_data)) {
        echo '
<li class="only4">
<a href="singleshop.php?name=' . $val['name'] . '">
<div class="img"><img src="dianmian.jpg" ></div>
<h2>' . $val['name'] . '</h2>
<p class="onlyheight">' . doesexistPic($val['picture'], $val['author']) . '</p>
<span class="icon">&nbsp;</span>
<div class="clr"></div>
</a>
</li>
		';
    }
} else {
    echo '<p align="center">无相关店面!</p>';
}
function doesexistPic($a, $b)
{
    if (!empty($a)) {
        return " <span id='caidan'>图片菜单</span>由<span id='zuozhe'>" . $b . "</span>提供";
    } else {
        return " 尚未提供图片菜单";
Example #2
0
function makeList($data)
{
    while ($val = mysql_fetch_array($data)) {
        //编列列表
        //传递店面名,name
        echo '
<li class="only4">
<a href="singleshop.php?name=' . $val['name'] . '">
<div class="img"><img src="dianmian.jpg" ></div>
<h2>' . $val['name'] . '</h2>
<p class="onlyheight">' . doesexistPic($val['picture'], $val['author']) . '</p>
<span class="icon">&nbsp;</span>
<div class="clr"></div>
</a>
</li>
		';
    }
}