$valid
是一个数组,$createdon
和$days
从数组中获取Date值。
我的选择查询不适用于PHP
变量的这些日期值,请解决它。
function checkexpiretime($valid)
{
$db = &JFactory::getDBO();
foreach($valid as $validity)
{
echo $createdon=$validity->CreatedOn;
echo $days=$validity->days;
}
echo $query="SELECT * FROM jos_generatekey WHERE CreatedOn BETWEEN DATE_ADD('".$createdon."',".INTERVAL $days DAY.")". "AND CURDATE()";
$db->setQuery($query);
$checkexpire = $db->loadObjectList();
print_r($checkexpire);
return $checkexpire;
}
答案 0 :(得分:0)
查询应该是这样的:
$query= "SELECT * FROM jos_generatekey WHERE CreatedOn BETWEEN DATE_ADD('".$createdon."',INTERVAL ". $days ." DAY) AND CURDATE()";