SqlDataprovider

when I tried to implement sqldataprovider in gridview I came across an error.Please help me rectify this error

Sqldataprovider in gridview error:

preg_match() expects parameter 2 to be string, array given

Thanks in advance

why using sqldataprovider why not activedataprovider?

share ur code line to rectify is there ny syntax error or not?

$query = new Query();

	     $query->select


			   ([


					'screen_ticket_booking_history.booking_date As Booking_date',


					'movies.movie_name As  Movie', 


					'theatres.theatre_name As  Theatre',


					'screen_ticket_booking_history.amount As Amount'


			   ]) 


			 ->from('screen_ticket_booking_history')


			 ->where('theatre_id=:theatre',['theatre'=>1])


			->join('LEFT OUTER JOIN', 'movies' ,'movies.id = screen_ticket_booking_history.movie_id')


			->join('LEFT OUTER JOIN', 'theatres' ,'theatres.id = screen_ticket_booking_history.theatre_id');


			  


		if($from_date!=''  )


		{


			$query->andWhere('booking_date >= :booking_date', [':booking_date' => $from_date]);


		}


		if($to_date!='' )


		{


			$query->andWhere('booking_date <= :booking_date1', [':booking_date1' => $to_date]);


		}


		if($movie!='' )


		{


			$query->andWhere('movie_id =:movie', [':movie' => $movie]);


		}


			  


			  


		 $command 	= $query->createCommand();


	     $result 	= $command->queryAll();


	   


	   


	   


	   


 $dataProvider = new SqlDataProvider([


'sql' => $query,


//~ 'totalCount'=>$count,q


'sort' => [


    'attributes' => 


    [


        //~ 'title' => [


            //~ 'asc' => ['title' => SORT_ASC],


            //~ 'desc' => ['title' => SORT_DESC],


            //~ 'default' => SORT_DESC,


            //~ 'label' => 'Post Title',


        //~ ],


        //~ 'author' => [


            //~ 'asc' => ['author' => SORT_ASC],


            //~ 'desc' => ['author' => SORT_DESC],


            //~ 'default' => SORT_DESC,


            //~ 'label' => 'Name',


        //~ ],


		//~ 'created_on'


    ],


],


'pagination' => [


    'pageSize' => 10,


],

]);

as per rules : if you want to use the pagination feature, you must configure the [[totalCount]] property

to be the total number of rows (without pagination).

read here: more Details