<?php if(isset($_POST["modal_id"])) { $output = ''; include('admin/config/dbcon.php'); $modal_id = $_POST["modal_id"]; // $find_sql = "select br_name from location where type='CRM' and id = ".$_POST["modal_id"]; $type = 'CRM'; $stmt = $conn->prepare("select br_name from location where type=? and id = ? LIMIT 1"); $stmt->bind_param("si", $type, $modal_id); $stmt->execute(); $result = $stmt->get_result(); // $find_sql = "select br_name from location where type='CRM' and id = $modal_id"; // $result = $conn->query($find_sql); $output .=' <div class="modal-header">'; while($rows=$result->fetch_assoc()){ $output .=' <h5 class="modal-title" id="myModalLabel">'.$rows['br_name'].'</h5>'; } $output .='<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> </div> <div class="modal-body"> <div class="details_modal"> <div class="col-7">'; $type='CRM'; $find_sql = "SELECT * FROM location WHERE type=? AND id = ?"; $stmt = $conn->prepare($find_sql); $stmt->bind_param("si",$type, $_POST["modal_id"]); // Assuming modal_id is a string. Use "i" for integer. $stmt->execute(); $result = $stmt->get_result(); // $find_sql = "select lattitude,longitude from location where type='CRM' and id = ".$_POST["modal_id"]; // $result = $conn->query($find_sql); $output .='<iframe style="width:100%;height:100%;" frameborder="0" scrolling="no" marginheight="0" marginwidth="0"'; while($rows=$result->fetch_assoc()){ $output .=' src="https://maps.google.com/maps?q='.$rows['lattitude'].','.$rows['longitude'].'&hl=en&z=14&amp;output=embed">'; } $output .='</iframe> </div> <div class="col-5"> <table class="table table-bordered table-striped" style="width:100%;font-size: 13px;height:100%;"> <tbody>'; $type='CRM'; $stmt = $conn->prepare("select * from location where type= ? and id = ? LIMIT 1"); $stmt->bind_param("si", $type, $_POST["modal_id"]); $stmt->execute(); $result = $stmt->get_result(); // $find_sql = "select * from location where type= ? and id = ?".$_POST["modal_id"]; // $result = $conn->query($find_sql); while($rows=$result->fetch_assoc()){ $output .=' <tr> <th width="40%">CRM Name</th> <td width="60%">'.$rows["br_name"].'</td> </tr> <tr> <th width="40%">ATM Address</th> <td width="60%">'.$rows["br_address"].'</td> </tr> <tr> <th width="40%">Inauguration Date</th> <td width="60%">'.$rows["inaguration"].'</td> </tr>'; } $output .='</tbody> </table> </div> </div> </div>'; echo $output; } ?>