我正在编写一个PHP应用程序,我得到一个查询,每天从我的数据库中获取数据,但我想在一天结束时只插入此数据,以保留记录。
聚苯乙烯。使用HighCharts显示此数据。
查询:
class Stats{
public function con()
{
require_once('connect.php');
$DB = new dbConnect();
return $DB->connect();
}
public function getToday($user){
$user = "SELECT user_id FROM tbl_user WHERE ott_email='$user'";
$query = mysqli_query($this->con(), $user);
$count = mysqli_num_rows($query);
if($count == 1){
while($row = mysqli_fetch_assoc($query)){
$id = $row['user_id'];
}
$today = "SELECT COUNT(tbl_template_log.user_id) FROM tbl_template_log ";
$today .= "WHERE tbl_template_log.user_id='$id'";
$today .= " AND DATE(send_date) = DATE(NOW())";
$query_today = mysqli_query($this->con(), $today);
$result = mysqli_fetch_row($query_today);
echo $result[0];
}
}
}
$stats_today = new Stats();
$stats_today->getToday($_SESSION['user']);
有人可以提出解决方案或一些提示吗,thx