Php? Returned results of mysql:
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;....
Reply to discussion (solution)
What does your php code mean?
What does your php code mean?
Read data from the database
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; }
Where does the data in your texture get from?
Where does the data in your texture get from?
Read from the database
It is an Array nested Array.
What I want is to directly query the value in Array (only one field in the table is queried)
Modify the following function.
function getAllone($sql) { $data = array(); if (!$error=$this->query($sql)) { $results = array(); while (!($error=$this->fetchArray($results))) { $data[] = $results; } } $this->free(); return $data; }
The problem is:
$ Results = array (); // This is an empty array
While (! ($ Error = $ this-> fetchArray ($ results ))){
$ Data [] = $ results; // You assign an empty array to $ data []. how can this problem be solved?
}
The problem is:
$ Results = array (); // This is an empty array
While (! ($ Error = $ this-> fetchArray ($ results ))){
$ Data [] = $ results; // You assign an empty array to $ data []. how can this problem be solved?
}
My fault
FetchArray () is a user-defined function,