当前位置:Gxlcms > PHP教程 > 利息保障倍数计算公式php团购折扣计算公式

利息保障倍数计算公式php团购折扣计算公式

时间:2021-07-01 10:21:17 帮助过:18人阅读

代码如下:


$price=$row['price']; //原价
$nowprice=$row['nowprice']; //现价
$jiesheng=$price-$nowprice; //节省金额
//$discount折扣计算
if ( $nowprice > 0 )
{
$discount = round(10 / ($price / $nowprice), 1);
}
else
{
$discount = 0;
}
if ( $discount <= 0 ) $discount = 0;


完整代码:

代码如下:






徐州汽车网最新团购



error_reporting(0);
header("Content-type: text/html; charset=gbk");
$con = mysql_connect("localhost","mysql用户名","mysql密码");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
// some code
mysql_select_db("tuanpcqc");
mysql_query("set names gbk");
$sql="select * from cenwor_tttuangou_product order by id desc limit 0,3";
$result = mysql_query($sql);
?>

while($row = mysql_fetch_array($result, MYSQL_BOTH)) {
$id=$row['id'];
$name = $row['name'];
$price = $row['price'];
$price=$row['price'];
$nowprice=$row['nowprice'];
$jiesheng=$price-$nowprice;
if ( $nowprice > 0 )
{
$discount = round(10 / ($price / $nowprice), 1);
}
else
{
$discount = 0;
}
if ( $discount <= 0 ) $discount = 0;
$pic=$row['img'];
$pic_arr=split(",",$pic);
$picadd=$pic_arr[0];
//echo $picadd;
$sql2="select * from cenwor_tttuangou_uploads whereurl");
$picurl=str_replace("/demo/","/thumb/200x121/demo/",$picurl);
?>


  • " target="_blank">

  • " target="_blank">buy














  • 原价 折扣 节省




}
?>

function getpic($pic){
}
mysql_close($con);
?>


以上就介绍了利息保障倍数计算公式 php 团购折扣计算公式,包括了利息保障倍数计算公式方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

人气教程排行