Maybe you can help me. DB connection is ok (Connected successfully
), the table name is correct (course_details
), but echo json_encode($data);
is NULL
<?php
include "db.php";
// Check connection
if ($con->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
$data=array();
$q=mysqli_query($con,"'SET CHARACTER SET utf8' select * from 'course_details'");
while ($row=mysqli_fetch_object($q)){
$data[]=$row;
}
echo json_encode($data);
$conn->close();
?>
Thanks in advance!