i got this error
PDOException: SQLSTATE[3D000]: Invalid catalog name: 1046 No database selected in C:\xampp\htdocs\crudsamp\notelist.php:11 Stack trace: #0 C:\xampp\htdocs\crudsamp\notelist.php(11): PDOStatement->execute() #1 {main}
this is my code
<?php
header("Access-Control-Allow-Origin: *");
require("db_conn.php");
$sql = "SELECT * FROM `tblnotes` ";
try {
$result = $conn->prepare($sql);
$result->execute();
if($result->rowCount()>0){
$loadlist = array();
while($row=$result->fetch(PDO::FETCH_ASSOC)){
$loadlist_arr[] = array(
"id" => $row["id"],
"task" => $row["task"],
);
}
echo json_encode($loadlist_arr);
}
}catch(PDOException $e){
die( "An error has been occured!" . $e);
}
?>