I have one PHP file name as report.php in which I also created one script for id using post type which I have one post type of ajax for pass id. I want to use that post type id in my report.php query to comparing id. so how can I get that post id in my $str query to compare?
<script type="text/javascript">
$(document).ready(function(){
$('#project').on('click',function(){
var pID = $(this).val();
alert(pID);
if(pID){
$("#developer").show();
$.ajax({
type:'POST',
url:'report1.php',
data:'id='+pID,
success:function(html){
$('#developer').html(html);
}
});
}
});
});
</script>
In Below query, I want to compare post type id with given value.
$str = "SELECT GROUP_CONCAT(CONCAT((u.firstname),' ',(u.lastname))) as dname, p.name, GROUP_CONCAT(t.hours)as spent_hrs, SUM(t.hours) as tot_spent,t.spent_on FROM time_entries as t
INNER Join projects as p on p.id = t.project_id
INNER Join users as u on u.id = t.user_id
where p.id=$_POST[id] and u.id=6
GROUP By p.id,t.spent_on ";