请指导,简单的数据库语句

WBOY
发布: 2016-06-13 11:59:49
原创
852 人浏览过

请指点,简单的数据库语句
$query = "select orderid from orders where  
               customerid = $customerid and  
               amount > ".$_SESSION['total_price']."-.001 and //这句是什么意思?   ."-.001 是什么意思?
               amount                date = '$date' and 
               order_status = 'PARTIAL' and 
               ship_name = '$ship_name' and 
               ship_address = '$ship_address' and 
               ship_city = '$ship_city' and 
               ship_state = '$ship_state' and 
               ship_zip = '$ship_zip' and 
               ship_country = '$ship_country'"; 
------解决方案--------------------
-0.001
+0.001
------解决方案--------------------
total_price 取值上下浮动 0.001饭碗内

例如
total_price = 1.001
取值 1.000 到 1.002
------解决方案--------------------
就是算术运算的-0.001 与 +0.001

例如$_SESSION['total_price'] 的值是 1

那么语句就相当于

$query = "select orderid from orders where  
               customerid = $customerid and  
               amount >0.999 and
               amount 
               date = '$date' and 
               order_status = 'PARTIAL' and 
               ship_name = '$ship_name' and 
               ship_address = '$ship_address' and 
               ship_city = '$ship_city' and 
               ship_state = '$ship_state' and 
               ship_zip = '$ship_zip' and 
               ship_country = '$ship_country'"; 

相关标签:
来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!