自己写了简单的销售查询页面 ,可是显示不出结果,求救

2016-07-07 15:00 来源:www.chinab4c.com 作者:ecshop专家

<?php
$conn = mysql_connect("localhost","","") or die("数据连接失败");
mysql_select_db("s498217db0",$conn);
mysql_query("set names 'GBK'");
?>
//数据库连接用户和密码已经被去掉,不是这里的问题

<form action="test.php" method="post">
开始时间:<input type="text" name="start_time"/>
结束时间:<input type="text" name="end_time"/>
商品分类:<input type="text" name="cat" />
加盟商:<input type="text" name="suppliers"/>
品牌:<input type="text" name="brand" />
用户:<input type="text" name="user" />
品名:<input type="text" name="goods_name" />
<input type="submit" name="submit" value="查询" />
</form>
// 输入查询条件

<?
$start_time = strtotime($_POST[start_time]);
$end_time = strtotime($_POST[end_time]);
$chaxun_ziduan="sc_order_info.order_sn,sc_order_goods.goods_name,sc_order_goods.send_number,sc_order_goods.goods_price,sc_order_info.confirm_time";
$biaodan="(((((sc_order_goods
inner JOIN sc_order_info ON sc_order_goods.order_id=sc_order_info.order_id)
inner join sc_goodson sc_goods.goods_id=sc_order_goods.goods_id)
INNER JOIN sc_brandon sc_goods.brand_id=sc_brand.brand_id )
INNER JOIN sc_categoryon sc_goods.cat_id=sc_category.cat_id )
INNER JOIN sc_userson sc_order_info.user_id=sc_users.user_id)
INNER JOIN sc_supplierson sc_goods.suppliers_id=sc_suppliers.suppliers_id";
$tiaojian="and confirm_time between $start_time and $end_time
and sc_suppliers.suppliers_name like '%$_POST[suppliers]%'
and sc_brand.brand_name like '%$_POST[brand]%'
and sc_category.cat_name like '%$_POST[cat]%'
and sc_users.user_name like '%$_POST[user]%'
and sc_goods.goods_name like '%$_POST[goods_name]%'
and sc_order_goods.send_number !=0";
$sql="select $chaxun_ziduan from $biaodan where $tiaojian";
$query=mysql_query($sql);
while ($row=mysql_fetch_array($query)) { ?>
<table align="center" bgcolor="#00FF00" cellpadding="1" cellspacing="1" border="1" width="100%">
<tr>
<th>订单号</th>
<th>商品名称</th>
<th>数量</th>
<th>售价</th>
<th>售出时间</th></tr>
<tr>
<td><?=$row[sc_order_info.order_sn]?></td>
<td><?=$row[sc_order_goods.goods_name]?></td>
<td><?=$row[sc_order_goods.send_number]?></td>
<td><?=$row[sc_order_goods.goods_price]?></td>
<td><?=$row[sc_order_info.confirm_time]?></td></tr></table>
<?
}
?>


希望厉害的人帮我看看,到底哪里有问题,不能显示查询的结果。谢谢了。

回答:
SQL查询语句我去除接收$_post[]条件后,mysql执行查询可以查到正确的结果。

达人救救吧,解决了,共享出来大家一起分享下,很多人应该都需要这样的功能吧