Olá meus caros!
Estou tentado executar este código:
<html> <head> <meta charset="UTF-8"> <title>Sistema</title> </head> <body> <div class='container'> <div class='row'> <h3 style="font-weight: 100;">Lista</h3> </div> <table class='table table-striped table-bordered'> <thead> <tr> <th>ID</th> <th>Nome</th> <th>Data</th> <th>Ações</th> </tr> </thead> <tbody> <?php include 'database.php'; $pdo = database::connect(); $sql = "SELECT * FROM tbfamiliar ORDER BY idFam DESC"; foreach ($pdo->query($sql) as $row) { } database::disconnect(); ?> </tbody> </table> </div> </body> </html>
Porém, está gerando essa mensagem de erro:
**Fatal error: Call to a member function query() on null in C:\xampp\htdocs\sistemaApac\index.php on line 39**
A linha de código indicada é esta:
foreach ($pdo->query($sql) as $row)
Alguém for favor pode me informar onde estou errando?
Obrigado.