I've been getting this error,
"Fatal error: Call to a member function setFetchMode() on a non-object in C:\Users\Public\wamp\www\audiotextCSVUpload\modified.php on line 34".
Can you please help me what is causing the error. In one of my computer, it is ok, but in our office, the error exists. Find below the code:
<?php
require_once 'dbconfig.php';
try {
$conn = new PDO("mysql:host=$host;dbname=$dbname", $username, $password);
$sql = 'SELECT phone, last_name, first_names
FROM contacts';
$q = $conn->query($sql);
$q->setFetchMode(PDO::FETCH_ASSOC);
} catch (PDOException $pe) {
die("Could not connect to the database $dbname :" . $pe->getMessage());
}
?>