<?php
require_once 'vendor/autoload.php';
$databasePath = __DIR__ . '/banco.sqlite';
$pdo = new PDO( 'sqlite:' . $databasePath);
$statemant = $pdo->query('SELECT * FROM student ;');
var_dump($statement->fetchAll());
Quando executo com o visual studio code aparece.
Notice: Undefined variable: statement in C:\xampp\htdocs\php-pdo-projeto-inicial\listasalunos.php on line 9 PHP Fatal error: Uncaught Error: Call to a member function fetchAll() on null in C:\xampp\htdocs\php-pdo-projeto-inicial\listasalunos.php:9 Stack trace:
#0 {main} thrown in C:\xampp\htdocs\php-pdo-projeto-inicial\listasalunos.php on line 9
Fatal error: Uncaught Error: Call to a member function fetchAll() on null in C:\xampp\htdocs\php-pdo-projeto-inicial\listasalunos.php:9 Stack trace:
#0 {main} thrown in C:\xampp\htdocs\php-pdo-projeto-inicial\listasalunos.php on line 9