hi guys i am working on movie ticket reservation project. using query i get all the theatres and their respective show time of a movie on a specific date, the thing is that i wanna display all the show times of a movie in one line where as i currently display them randomly.
i was told i should build array(array building dats what they said ) is there any other possiblities and also how can i buiid it (array building)
this my controller code for finding all theatres and show time
public function actionTime($id,$ids)
{
$query2 = new Query();
$query = new Query();
$query->select
([
'screen_show_times.start_time As Ti','movie_shows.screen_id As Ts','movie_shows.theatre_id As Theatre','movie_shows.show_time_id As Show_time'
])
->from('movie_shows')
->join('LEFT OUTER JOIN','screen_show_times','movie_shows.show_time_id=screen_show_times.id')
->where('start_date<=:id',['id'=>$ids])
->andWhere('end_date>=:no',['no'=>$ids])
->andWhere('movie_shows.movie_id=:di',['di'=>$id]);
$query2->select
([
'screen_show_times.start_time As Ti','movie_shows.screen_id As Ts','movie_shows.theatre_id As Theatre','movie_shows.show_time_id As Show_time'
])
->from('movie_shows')
->join('LEFT OUTER JOIN','screen_show_times','movie_shows.show_time_id=screen_show_times.id')
->where('movie_shows.start_date<=:id',['id'=>$ids])
->andWhere('end_date>=:no',['no'=>null])
->andWhere('movie_shows.movie_id=:di',['di'=>$id])
->union($query);
$command = $query->createCommand();
$result = $command->queryAll();
return $this->render('buytickets', [
'result' => $result,
'movie' => $id,
'mov_date'=>$ids,
]);
}
thanks