ManaPHP\Db::fetchAll PHP Méthode

fetchAll() public méthode

Dumps the complete result of a query into an array Getting all robots with associative indexes only $robots = $connection->fetchAll("SELECT * FROM robots", \ManaPHP\Db::FETCH_ASSOC); foreach ($robots as $robot) { print_r($robot); } Getting all robots that contains word "robot" withing the name $robots = $connection->fetchAll("SELECT * FROM robots WHERE name LIKE :name", ManaPHP\Db::FETCH_ASSOC, array('name' => '%robot%') ); foreach($robots as $robot){ print_r($robot); }
public fetchAll ( string $sql, array $bind = [], integer $fetchMode = PDO::FETCH_ASSOC ) : array
$sql string
$bind array
$fetchMode integer
Résultat array
    public function fetchAll($sql, $bind = [], $fetchMode = \PDO::FETCH_ASSOC)
    {
        $result = $this->query($sql, $bind, $fetchMode);
        return $result->fetchAll();
    }