php网站输入价格范围搜索商品
答案:4 悬赏:70 手机版
解决时间 2021-02-02 21:25
- 提问者网友:战魂
- 2021-02-02 10:24
代码的,
最佳答案
- 五星知识达人网友:鸠书
- 2021-02-02 11:11
$start=10;//获取价格范围的较小值
$end=50;//获取价格范围的较小值
1.
$sql = "SELECt * FROM Product WHERe Price >= '$start' and Price <= '$end' ";
2.
$sql = "SELECt * FROM Product WHERe Price BETWEEN '$start' AND '$end' ";
$end=50;//获取价格范围的较小值
1.
$sql = "SELECt * FROM Product WHERe Price >= '$start' and Price <= '$end' ";
2.
$sql = "SELECt * FROM Product WHERe Price BETWEEN '$start' AND '$end' ";
全部回答
- 1楼网友:老鼠爱大米
- 2021-02-02 12:33
有偿服务,QQ群44930121
- 2楼网友:笑迎怀羞
- 2021-02-02 12:17
<html>
<head>
<script type="text/javascript">
</script>
</head>
<body onbeforeunload="closechild()">
<form action="getgoods.php"method="post">
<table><tr><td>from</td><td><input type='text'name='from'id='from'/>
</td><td>to</td><td><input type='text'name='to'id='to'/></td><td><input
type='submit'value='search'/></td></tr></table></form>
</body>
</html>
php 文件
连接数据库的语句自己写上!
<html>
<head>
<script>
window.close();
</script>
</head>
<body>
<p><?php
$from=$_post['from'];
$to=$_post['to'];
$sql="select * from abs where price>$from and price<$to";
$rs=mysql_query($sql) or die ($sql);
while(($row=mysql_fetch_assoc($rs))!=0){
$$price=$row['price'];
}
echo $price;
?></p>
</body></html>
- 3楼网友:妄饮晩冬酒
- 2021-02-02 11:53
用表单接收两个价格p1,p2 ,在对数据库的操作界面用$_REQUEST,接收两个值,
然后用select × from products where price>p1 and price
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯