Good Afternoon!
I have made a connection class to a Microsoft Access Database (which works). However my problem lies where I\'m trying to use this class to execute a
$result is just a boolean that indicates whether the query was successful or not. The fetchAll method is on PDOStatement, so it should be:
while ($row = $sql->fetch(PDO::FETCH_ASSOC)) {
You're also executing the statement wrong, it should be:
$result = $sql->execute();
The method you used is for executing a SQL string without first preparing it. You could instead do:
$result = $pdoConnection->exec("SELECT * FROM celebs");
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {