我想在我的一些数据上使用图表并根据选定的日期(使用日期选择器)生成值。我在网上偷了大部分东西,可能只有一个简单的问题。
这是惯用语查询:
if (isset($_GET['start']) AND isset($_GET['end'])) {
$start = $_GET['start'];
$end = $_GET['end'];
$data = array();
// Select the results with Idiorm
$results = ORM::for_table('tbl_data')
->where_gte('date', $start)
->where_lte('date', $end)
->order_by_desc('date')
->find_array();
// Build a new array with the data
foreach ($results as $key => $value) {
$data[$key]['label'] = $value['date'];
$data[$key]['value'] = $value['rev'];
}
echo json_encode($data);
}
$start
和$end
来自我的日期选择器和格式yyyy-mm-dd
。我唯一不知道该怎么做的就是如何更改->where_gte
语句。如您所见,它正在查询数据库中的 field date
。在我的数据库中,我有三个字段year
,month
和day
。
有没有办法将这三个字段组合成一个表达式year
,即也许???month
day
->where_gte('year'&'month'&'day', $start)
我尝试搜索和搜索,但可能有错误的关键字或知识较少。
提前感谢您的帮助!