我有这样的代码:
function mgl_get_by($col,$id)
{
$this->db->select('*');
$this->db->from('global_info');
$this->db->join('ad', 'id_ad = id_global_info');
$this->db->where('info_type_id', 1);
$this->db->where($col, $id);
$this->db->or_where("$col REGEXP $id");
$this->db->order_by('paid', 'desc');
$this->db->order_by('date_created', 'desc');
$q = $this->db->get();
return $q = $q->result_array();
}
$col是表中行的名称,$id是查询的唯一 ID。在大多数情况下它是唯一的数字,但是我在这个表中有日期行,并且在表中它作为时间戳插入,但是在执行查询时它需要选择所选日期的所有匹配项(例如它需要选择所有数据从 2012 年 6 月 11 日开始)。我该怎么做(我不熟悉 REGEXP)?