I’m trying to retrieve some entries from a database. Unfortunately, I’m getting this error:
“Fatal error: Call to a member function fetch() on a non-object in C:\Wamp\www\projectpostup\db.inc.php on line 82”
This is my script. I’m using PDO to access the MySQL db. “ERROR LINE” represents line 82, the one reporting the error.
$db = new PDO(DB_INFO, DB_USER, DB_PASS); $sql = "SELECT entries FROM entrylist ORDER BY created DESC"; $stmt = $db->query($sql); ERROR LINE $result = $stmt->fetch(PDO::FETCH_NUM); $stmt->closeCursor(); $db = null; var_dump($result);
Any help? I’m just getting my feet wet with PHP and I enjoy it so far… I just can’t get this stupid thing to work.