这是我的表:
我想根据issue_morn + issue_noon + issue_night的总和来订购结果。
试过这个:
<?php
$date1="";
$date2="";
if(!empty($_POST['datepicker1']) && !empty($_POST['datepicker1'])&& !empty($_POST['issue_noon'])&& !empty($_POST['issue_morn'])&& !empty($_POST['issue_night']))
{
$date1 = date("Y-m-d",strtotime($_POST['datepicker1']));
$date2 = date("Y-m-d",strtotime($_POST['datepicker2']));
$issue= (int)$_POST['issue_morn']+(int)$_POST['issue_noon']+(int)$_POST['issue_night'];
$sth = $conn->prepare('Select * From inventory where date between :date1 and :date2 ORDER BY :issue');
$sth->execute(array(':date1'=>$date1,':date2'=>$date2, ':issue'=>$issue));
$data = $sth->fetchAll();
?>
但没有得到任何价值观。在我将“&#39;”命令包括在内之前,我得到了日期明智的价值观。查询中的属性。