Php 旋转横幅上显示的金额随每次页面重新加载而变化
我们正面临一个非常奇怪的问题,我试图寻找解决方案,但没有找到。我们在核心php中构建了一个站点,它有一个旋转的横幅/滑块,当用户在站点上购买东西时,该横幅/滑块显示的金额会发生变化 例如,网站销售额为1000美元,每次用户购买时,横幅上的数字从1000美元变为1050美元,以此类推 现在面临的问题是,有时候,并非所有时候,当我们刷新页面时,横幅上的金额会增加一个特定的金额,比如说25美元。因此,如果你刷新页面4次,金额将增加100美元 有人能告诉我这里可能出了什么问题吗Php 旋转横幅上显示的金额随每次页面重新加载而变化,php,jquery,html,flash,slider,Php,Jquery,Html,Flash,Slider,我们正面临一个非常奇怪的问题,我试图寻找解决方案,但没有找到。我们在核心php中构建了一个站点,它有一个旋转的横幅/滑块,当用户在站点上购买东西时,该横幅/滑块显示的金额会发生变化 例如,网站销售额为1000美元,每次用户购买时,横幅上的数字从1000美元变为1050美元,以此类推 现在面临的问题是,有时候,并非所有时候,当我们刷新页面时,横幅上的金额会增加一个特定的金额,比如说25美元。因此,如果你刷新页面4次,金额将增加100美元 有人能告诉我这里可能出了什么问题吗 很抱歉没有提前添加代码
很抱歉没有提前添加代码 此代码位于codeigniter中
Controller file say home.php code
$count_Values = $this->home_model->countHome();//check if there any
update in order table ie if any purchase made or not
$count_Values1 =$this->home_model->getTotalDonation();//get total
doantion amount from db
$updateDonation =$this->home_model->updateDonationDetails($count_Values);//update
amount on db
$data['count'] = number_format($count_Values1,0);//for view
Model file say home_model.php
/*
@Function name:countHome
@Purpose :Used to count donation in order table
*/
public function countHome()
{
$this->db->select('modify_date');
$this->db->from('tbl_common');
$this->db->where('id',1);
$query1=$this->db->get();
$result=$query1->row();
$date =$result->modify_date;
$query=$this->db->query("select sum(pac_donation_to_owner) as totalpac
from tbl_order where order_status='1' and order_createddate >
'$date'");
$total = $query->row()->totalpac;
return ($total);
}
/*
@Function name:getTotalDonation
@Purpose :get total donation
*/
public function getTotalDonation()
{
$this->db->select('value');
$this->db->from('tbl_common');
$this->db->where('id',1);
$query=$this->db->get();
$result=$query->row();
return $result->value;
}
/*
@Function name:updateDonationDetails
@Purpose:for update total donation in tbl_common
*/
public function updateDonationDetails($values)
{
$this->db->select('value');
$this->db->from('tbl_common');
$this->db->where('id',1);
$query =$this->db->get();
$result =$query->row();
$updateValue = $result->value;
$data['modify_date'] = date('Y-m-d h:i:s');
$data['value'] =$values+$updateValue;
$this->db->where('id',1);
$this->db->update('tbl_common', $data);
}
View.php file
<?php echo $count; ?>
谢谢给我一些代码。你讲的是一个很好的老故事。我们需要一些代码。我只能假设banner实际上并没有将值添加到一起,只显示传递给它的值,否则这是一个非常错误的设计。因此,问题很可能发生在后端。很抱歉没有提前添加代码:横幅只显示从数据库传递给它的值。数据库具有正确的条目,并且将值添加到横幅的问题仅出现在前端,数据库不受影响。我还复制了代码供您参考。提前谢谢。