I'm working on Core php, i'm on click of div data is coming and i store a variable and i want pass check with database query it it is matching will come all the records how to do this please help any one.
Html code:
<div class="col-lg-3 col-md-6 test" data-idtest="Diabetes">
<a href="" class="box_cat_home">
<i class="icon-info-4"></i>
<img src="assets/img/icon_cat_3.svg" width="60" height="60" alt="">
<h3>Diabetes</h3>
<ul class="clearfix">
<li><strong>124</strong>Doctors</li>
<!-- <li><strong>60</strong>Clinics</li> -->
</ul>
</a>
</div>
Jquery code:
<script type="text/javascript">
$(document).ready(function() {
$('.test').click(function (){
var id = $(this).data('idtest') ;
//alert(id);
$.ajax({
url : "getting.php",
type: 'POST',
data : {id:id },
}).done(function(response) {
});
})
});
</script>
Php code:
<?php
echo "ejejejej";
$dbHost = 'localhost';
$dbUsername = 'root';
$dbPassword = 'mysql';
$dbName = 'fre';
$id =$id;
$db = new mysqli($dbHost,$dbUsername,$dbPassword,$dbName);
$men ="select * from tbl_users where doctor_speciality = $id";
$men_result=$db->query($men);
$projects=array();
while($row=mysqli_fetch_assoc($men_result)){
$projects[] = $row;
}
?>