0
我正在使用codeigniter 2xx。 MySQL表:codeigniter活動記錄where_in
create table hobby (
id int,
school varchar,
classes varchar,
basketball text, {12,15,17...}
football text, {12,18,20...}
swimming text {11,15,....}
);
我打算存儲學生ID作爲在像籃球,足球和游泳MySQL表字段序列化(陣列(整數))。
我想找出一個特定的班級學生ID(如12),如果他加入任何愛好或超過1個愛好使用codeigniter活動記錄方法,但卡住了。下面是我的代碼:
$this->db->select('basketball','football','swimming');
$this->db->or_where('school', $data)->where('classes', $classid)->where_in($student_id, 'basketball');
$this->db->or_where('school', $data)->where('classes', $classid)->where_in($student_id, 'football');
$this->db->or_where('school', $data)->where('classes', $classid)->where_in($student_id, 'swimming');
$query = $this->db->get('hobby');
還是有更好的方式來存儲&處理信息?
感謝ü這麼多的指點:) – user1884324
歡迎您) –