The below code has only array like ["a","b","c"] but returns [Object,Object,Object]. The result of which I need to use nested $each loop in ajax success function. Is there any better way to do it?
if($_GET['semValue'])
{
$sem_value = $_GET['semValue'];
try
{
$stmt = $dbConn->prepare("SELECT Semester FROM CourseInfo");
$semArray = array();
if ($stmt->execute())
{
while ($row = $stmt->fetch(PDO::FETCH_ASSOC))
{
$semArray[] = $row;
}
}
echo json_encode($semArray);
exit();
}
catch(PDOException $e)
{
echo 'Exception -> ';
var_dump($e->getMessage());
}