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
欢迎您) –