Commit 8fa0ae36 by Jansa Jose

find ride

parent 809bc886
......@@ -956,8 +956,10 @@ function offer_update($request){
$this->db->where('no_of_seats >=',$request['seats']);
$this->db->where('ride.status!=',2);
$this->db->where('ride.ride_status!=',3);
$this->db->where('ride.user_id!=',$request['user_id']);
$this->db->or_where('ride.ride_status!=',4);
$this->db->or_where('ride.ride_status!=',5);
$this->db->order_by('ride.id','DESC');
if($request['user_id']!='undefined'){
$this->db->where('users_id!=',$request['user_id']);
}
......@@ -2376,13 +2378,19 @@ public function update_currency($data){
}
public function get_ride_members($data){
$this->db->select("TRIM(concat(users.first_name,' ',IFNULL(users.last_name,''))) as name,IF(users.profile_photo != NULL OR users.profile_photo != '' , concat('".base_url()."',users.profile_photo) , '') profile_pic,users.id as rider_id,booking.status");
$this->db->select("DISTINCT(TRIM(concat(users.first_name,' ',IFNULL(users.last_name,'')))) as name,IF(users.profile_photo != NULL OR users.profile_photo != '' , concat('".base_url()."',users.profile_photo) , '') profile_pic,users.id as rider_id,booking.status");
$this->db->join('users','users.id = booking.user_id');
$this->db->where('booking.ride_id',$data['ride_id']);
$this->db->where('booking.user_id !=',$data['user_id']);
$this->db->group_by('booking.user_id');
$result = $this->db->get('booking')->result();
//echo $this->db->last_query();exit;
if($result){
foreach ($result as $key => $value) {
$this->db->select('sum(no_of_seats) as no_seats');
$ride_data = $this->db->get_where('booking',array('user_id'=>$value->rider_id,'ride_id'=>$data['ride_id']))->row();
$result[$key]->no_of_seats = $ride_data->no_seats;
}
$res = array('status'=>'success','data'=>$result);
}else{
$res = array('status'=>'error');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment