你好,这是我的代码,我想让它动态化,请给我一个解决方案。
$start = strtotime($this->input->post('leave_from'));
$end = strtotime($this->input->post('leave_to'));
$days_between = ceil(abs($end - $start) / 86400 + 1);
if($this->input->post('leave_type') == 3){
$days_between = 0.5;
}
我想让这个动态化,如何使用查询来实现。
$q = "set leave_applications.days = '0.5' on leave_applications where leave_type = 3 ";
$days_between = $this->leave_application_model->q_single($q);
不知道这样对不对,但是报错
Unknown system variable 'days' set leave_applications.days = '0.5' on leave_applications where leave_type = 3
帮我看看怎么做。 谢谢。
最佳答案
UPDATE `leave_applications` SET `days` = '0.5' WHERE `leave_type` = 3
关于php - 如何在动态查询中生成静态值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39701731/