 <?php
include("../../db.php");
//header("Access-Control-Allow-Origin: * ");
header('Content-Type: application/json');
	
 $sql = $db->getRows("select s.head,s.added_by,s.school_id,p.id,p.image_name,p.date from image_head as s inner join image_upload as p on s.id=p.head");
  $jsonn = array();
// 	$result = mysql_query($sql);
		if($sql>0)
	{
//   while ($row = mysql_fetch_assoc($result)) 	
    foreach($sql as $row)
	{
    	$jsonn[]=array("id" =>$row['id'],"head" =>$row['head'],"image_name" =>"uploads/gallery/".$row['image_name'],"date" =>$row['date'],"added_by" =>$row['added_by'],"school_id" =>$row['school_id']);
 	    $json['status']=1;
		$json['msg']="successful";
		$json['data']=$jsonn;
	//	$json['section']=$jsonc;
	}

	if(empty($json))
	{
        $json['status']=0;	
     	$json['msg']="data not found";
 		echo json_encode($json);	
	}
	else
	{
	echo json_encode($json);
	}

}
else
{
 	echo json_encode(array('status' => 0, 'msg'=>'gallery not found..!', "data"=>$jsonn));
}
?>