想要的返回结果:
array
(
[0]=>3
[1]=>59
[2]=>23
[3]=>4
[4]=>61
)
.... $data = array(); if (!$error=$this->query($sql)) { $results = array(); while (!($error=$this->fetcharray($results))) { $data[] = $results; } } $this->free(); return $data;....
你那段 php 代码是什么意思?
你那段 php 代码是什么意思?
public getInfo(){ $sql="select * from table"; $result=$this->db->getAllone($sql); return $result;}function getAllone($sql) { $data = array(); if (!$error=$this->query($sql)) { $results = array(); while (!($error=$this->fetchArray($results))) { $data[] = $results; } } $this->free(); return $data; }那你贴图中的数据是从哪里得到的?
那你贴图中的数据是从哪里得到的?
function getAllone($sql) { $data = array(); if (!$error=$this->query($sql)) { $results = array(); while (!($error=$this->fetchArray($results))) { $data[] = $results; } } $this->free(); return $data; } 问题是:
$results = array(); //这是一个空数组
while (!($error=$this->fetchArray($results))) {
$data[] = $results; //你把一个空数组赋值给 $data[],怎么会有截图中的数据呢?
}
问题是:
$results = array(); //这是一个空数组
while (!($error=$this->fetchArray($results))) {
$data[] = $results; //你把一个空数组赋值给 $data[],怎么会有截图中的数据呢?
}
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号