ManaPHP\Db::fetchOne PHP Méthode

fetchOne() public méthode

Returns the first row in a SQL query result Getting first robot $robot = $connection->fetchOne("SELECT * FROM robots"); print_r($robot); Getting first robot with associative indexes only $robot = $connection->fetchOne("SELECT * FROM robots", \ManaPHP\Db::FETCH_ASSOC); print_r($robot);
public fetchOne ( string $sql, array $bind = [], integer $fetchMode = PDO::FETCH_ASSOC ) : array | false
$sql string
$bind array
$fetchMode integer
Résultat array | false
    public function fetchOne($sql, $bind = [], $fetchMode = \PDO::FETCH_ASSOC)
    {
        $result = $this->query($sql, $bind, $fetchMode);
        return $result->fetch();
    }