Db::getAll PHP Méthode

getAll() private méthode

获得所有的查询数据
private getAll ( ) : array
Résultat array
    private function getAll()
    {
        //返回数据集
        $result = array();
        if ($this->numRows > 0) {
            while ($row = mysql_fetch_assoc($this->queryID)) {
                $result[] = $row;
            }
            mysql_data_seek($this->queryID, 0);
        }
        // var_dump($result);
        return $result;
    }

Usage Example

 public function get_data_for_main_page()
 {
     $db = new Db();
     $components = $db->getAll("SELECT `title`,`name` FROM ##extensions WHERE `type`='component' AND `enabled`=1");
     $modules = $db->getAll('SELECT `name`,`id` FROM ##modules WHERE `published`=1');
     echo Json::encode([$components, $modules]);
 }
All Usage Examples Of Db::getAll