<?php
require_once "connection.php";
if(isset($_GET['jenis_kendaraan'])){
    $sql = "SELECT idJenis,idMerk,namaMerk FROM tblMerkKendaraan WHERE idJenis in ( select idJenis from tblJenisKendaraan where namaJenis='".$_GET['jenis_kendaraan']."')";
    if(!$con->query($sql)){
        echo "Error in executing query.";
    }else{
        $result = $con->query($sql);
        if($result->num_rows > 0){
            $return_arr['merk'] = array();
            while($row = $result->fetch_array()){
                array_push($return_arr['merk'], array(
                    'namaMerk'=>$row['namaMerk']
                ));
            }
            echo json_encode($return_arr);
        }
    }
}
?>