//this is my connection function. It is connecting databse successfully when I check.
$conn = connection($config['servername'],$config['username'],$config['password']);
after that I used the following code to retrieve data from a database
$id = 2;
if($conn) {
try {
$stmt = $conn->prepare('SELECT * FROM customer_tbl WHERE cus_id = :id');
$stmt->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt->bindParam(':id', $id);
$results = $stmt->execute();
}catch (PDOException $e){
echo 'Error: ' . $e->getMessage();
}
}
this code shows the following error message in browser
Error: SQLSTATE [IM001]: the driver does not support this function: this driver does not support configuration attributes
what is wrong with my code ?. Why couldn’t I get the data from the database?
if i want to extract this data from databese using make statement how to encode?
source
share