ok
Direktori : /home/ngwcolle/www/LIBRARY-NGWC/admin/ajax/ |
Current File : /home/ngwcolle/www/LIBRARY-NGWC/admin/ajax/getclass.php |
<?php include('../includes/dbconnection.php'); $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); if(!empty($_POST["id"])){ // Fetch state data based on the specific country $clid=$_POST['id']; $promoid=$_POST['promotype']; // $type=$_POST['val']; if($promoid==1){ // $sql="SELECT classname,nextclass FROM tblclass WHERE id=$clid"; $sql="SELECT a.nextclass as id,b.classname as classname from tblclass as a inner join tblclass as b on a.nextclass=b.id where a.id=$clid"; } else { $sql="SELECT id ,classname FROM tblclass WHERE id=$clid"; } $query1 =$dbh->prepare($sql); $query1->execute(); // // Generate HTML of state options list // // echo '<option value="">Select State</option>'; $row = $query1->fetch(PDO::FETCH_ASSOC); $response=$row; echo json_encode($response); // echo '<option value="">MMM</option>'; // echo '<option value="'.$row['id'].'">'.$row['classname'].'</option>'; } ?>