只能把二维转成一维的了:
用result_array取到二维数组
再用array_column,转为一维数组
例:
$sql = 'select name from user'
$result = $this->db->query($sql)->result_array()
$one = array_column($result, 'name')
print_r($one)//这个就是一维数组了
一个基本查询的逻辑过程:(8) SELECT (9) DISTINCT (11) <TOP_specification><select_list>
(1) FROM <left_table>
(3)<join_type>JOIN <right_table>
(2) ON <join_condition>
(4) WHERE <where_condition>
(5) GROUP BY <group_by_list>
(6) WITH {CUBE | ROLLUP}
(7) HAVING <having_condition>
(10) ORDER BY <order_by_list>--数字表示的是语句中部分的执行顺序。完全的结构语句如下列: SELECT DISTINCT top 5 * FROM table1
left JOIN table2 ON (table1.id=table2.id)
WHERE table1.id>10 GROUP BY table1.id HAVING table1.name like '张%'
ORDER BY name
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)