<?php 
include("../db_connection.php");
if($_POST['status']=="accepted")
{
	$tblads=mysql_query("update tbl_ads set admin_status='Archived' where ads_id='".$_POST['ad']."'");
	$sql=mysql_query("update tbl_queries set status='".$_POST['status']."',read_status='read' where queryid='".$_POST['id']."'");

	$query=mysql_query("select * from tbl_queries where queryid='".$_POST['id']."'");
	$resquery=mysql_fetch_assoc($query);
	
	$querybyid=$resquery['querybyid'];
		
				
		mysql_query("insert into tbl_notification (user_id,ads_id,query_statusid,datetime)values('".$querybyid."','".$_POST['ad']."','".$_POST['id']."',NOW())");
		
		
		
	
	//
	

}
else
{
	$tblads=mysql_query("update tbl_ads set admin_status='Approved' where ads_id='".$_POST['ad']."'");
	$sql=mysql_query("update tbl_queries set status='".$_POST['status']."',read_status='' where queryid='".$_POST['id']."'");
	
	$query=mysql_query("select * from tbl_queries where queryid='".$_POST['id']."'");
	$resquery=mysql_fetch_assoc($query);
	
	$querybyid=$resquery['querybyid'];
		
				
		mysql_query("insert into tbl_notification (user_id,ads_id,query_statusid,datetime)values('".$querybyid."','".$_POST['ad']."','".$_POST['id']."',NOW())");
		
		
		
	

}


?>