示例#1
0
 /*$sql="select users.id as uid,users.username,users.photo,photos.*,photos.id as pid,Year(NOW())-Year(photos.date) as time_elapsed,photos.date as photo_date from date_request join users on user_id_requestor=users.id join photos on photos.user_id=date_request.user_id_owner and (date_format(photos.date,'%m-%d')=date_format(  '$user_date','%m-%d') or (DATE(photos.date) BETWEEN ('$user_date' - INTERVAL 6 DAY) AND ('$user_date'))) where user_id_owner=:uid and status=0";*/
 //echo $sql;die;
 $sth = $conn->prepare($sql);
 $sth->bindValue("uid", $uid);
 try {
     $sth->execute();
 } catch (Exception $e) {
 }
 $res1 = $sth->fetchAll();
 if (count($res1)) {
     $success = '1';
     $msg = "Request Found";
     if ($res1) {
         foreach ($res1 as $key => $value) {
             if (!isset($final[$value['uid']])) {
                 $final[$value['uid']] = array('requestor_id' => $value['uid'], 'username' => $value['username'] ? $value['username'] : "", 'user_pic' => $value['photo'] ? BASE_PATH . "timthumb.php?src=uploads/" . $value['photo'] : "", 'pictures' => DataClass::get_pictures($value['uid'], $uid, $zone, $user_date, $date));
             }
             /*if(!ISSET($final[$value['uid']]['pictures'][$value['pid']])){
             		if($value['pid']){
             		$final[$value['uid']]['pictures'][$value['pid']]=array(
             			"image_id"=>$value['pid']?$value['pid']:"",
             			"image_url"=>$value['image']?BASE_PATH."timthumb.php?src=uploads/".$value['image']:"",
             			"time_elapsed"=>$value['time_elapsed']?$value['time_elapsed']:0,
             			"photo_date"=>$value['photo_date']?$value['photo_date']:""
             			);
             		}}*/
         }
     }
     if ($final) {
         foreach ($final as $key => $value) {
             $data2 = array();