I am currently trying to pass through a variable to act like a where clause so I can pass it to the URL and display content for each event on a page.

To do this, I'd need to pass the event\_id.

```
public function exportSearch($event_id){

        $query = "SELECT
                    u.prefix AS  'Title', 
                    u.forename AS  'Forename', 
                    u.surname AS  'Surname', 
                    u.telephone AS 'Mobile Number',
                    u.email AS  'Email Address', 
                    ea.checkin_status_id AS 'checked in',
                    u.update_time AS  'Register Date', 
                    eg.name AS 'Event Group Registered', 
                    e.name AS  'Session Registered', 
                    u.bio AS 'User Information',
                    u.dob AS 'Date of Birth',
                    u.company AS 'Company',
                    u.company_role AS 'Company Role',
                    CONCAT(u2.forename, ' ', u2.surname) AS 'Guest of',
                    MAX(CASE WHEN uv.user_type_variables_id = 1 THEN uv.value ELSE NULL END) AS Question1,
                    MAX(CASE WHEN uv.user_type_variables_id = 2 THEN uv.value ELSE NULL END) AS Question2,
                    MAX(CASE WHEN uv.user_type_variables_id = 3 THEN uv.value ELSE NULL END) AS Question3,
                    MAX(CASE WHEN uv.user_type_variables_id = 4 THEN uv.value ELSE NULL END) AS Question4,
                    MAX(CASE WHEN uv.user_type_variables_id = 5 THEN uv.value ELSE NULL END) AS Question5,
                    MAX(CASE WHEN uv.user_type_variables_id = 6 THEN uv.value ELSE NULL END) AS Question6

                    FROM tbl_event_attendees AS ea

                    LEFT JOIN tbl_user AS u ON ea.user_id = u.id
                    LEFT JOIN tbl_event AS e ON ea.event_id = e.id
                    LEFT JOIN tbl_event_groups AS eg on e.group_id = eg.id
                    LEFT JOIN tbl_user AS u2 ON ea.guest_of_user_id = u2.id
                    LEFT JOIN tbl_user_variables AS uv on u.id = uv.user_id

                    GROUP BY ea.id";

           // $query->params([':event_id' => $event_id]);

        $count=Yii::app()->db->createCommand($query)->queryScalar();
        return $sqlDataprovider = new CSqlDataProvider($query, array(
                'totalItemCount'=>$count,
                'sort'=>array(
                    'attributes'=>array(
                       // 'event_name'=>Event::model()->getAttributeLabel('name'), // csv of sortable column names
                        //'Question1' => EventAttendees::model()->getAttributeLabel('Question1'),
                        // 'Forename',

                    )
                ),
                 'pagination'=>array(
                 'pageSize'=>$count, //Show all records
        ),
            ));
     }

```

My idea was to use $query->params to do this and then throw it over to the view but had no luck.

It needs to display something like WHERE ea.event\_id = $event\_id but I can't seem to pass it through via the raw sql.