Fatal error: Call to a member function fetchALL() on a non-object - using PDO on a Microsoft Access Database

后端 未结 2 1715
执念已碎
执念已碎 2020-12-20 10:05

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

2条回答
  •  鱼传尺愫
    2020-12-20 10:36

    ini_set('display_errors', '1');
    include_once '\classes\connectionClass.php';
    $con = new connection();
    $pdoConnection = $con->connect();
    
    $data = $pdoConnection->query("SELECT * FROM celebs")->fetchAll();
    foreach ($data as $row) {
       echo $row['firstname'];
       echo $row['surname'];
    }
    

    this is all the code you need.

提交回复
热议问题