[solved] export search data

hi all, saya mau tanya ada yang tau cara export ke csv to ke xlsx?

saya punya code seperti ini menggunakan csvexport extension :


		Yii::import('ext.CSVExport');

		$date = explode("a",$_GET['date']);

		$title = $_GET['title'];

		$media = $_GET['media'];

		$adv = $_GET['adv'];

		$prod = $_GET['prod'];

		$group = $_GET['group'];

		

		$provider = Yii::app()->db->createCommand('select b.execution_date,b.topik,m.name as id_media_seller,p.name as id_product_category,a.name as id_advertiser,bt.name as id_group,b.price from tbl_batch b,tbl_media_seller m,tbl_product_category p, tbl_advertiser a, tbl_bts_group bt where (execution_date >= '.$date[0].' and execution_date <= '.$date[1].') and a.id = b.id_media_seller and p.id = b.id_product_category and m.id = b.id_media_seller and bt.id = b.group_id')->queryAll();

		$csv= new CSVExport($provider);

		

		$csv->headers = array('execution_date'=>'Date','topik'=>'Topik','id_media_seller'=>'Media Seller','id_product_category'=>'Product Category','id_advertiser'=>'Advertiser','price'=>'Price');

		$csv->exportFull = false;

		$content = $csv->toCSV();

		$filename = ''.$title.'.csv';

		$content = $csv->toCSV(''.$title.'.csv',"\t","'");

		Yii::app()->getRequest()->sendFile($filename,$content,"text/csv",faLse);

		exit();



tapi pas mau liat isi filenya, ternyata kosong. mohon bantuannya.

thanks

gan, bisa dijelaskan solvingnya, karena tidak ada yg kasih komen, tetapi tiba2 judulnya solved. Thanks gan

ini code yang sudah bisa diexport tapi export ke .csv


$provider = null;

$csv = null;

$content = null;


$provider = Yii::app()->db->createCommand("select b.execution_date,b.topik,m.name as id_media_seller,p.name as id_product_category,a.name as id_advertiser,bt.name as id_group,b.price from tbl_batch b,tbl_media_seller m,tbl_product_category p, tbl_advertiser a, tbl_bts_group bt where (execution_date >= '".$to."' and execution_date <= '".$from."') and (b.deleted is null or b.deleted <> 1) and a.id = b.id_advertiser and p.id = b.id_product_category and m.id = b.id_media_seller and bt.id = b.group_id")->queryAll();


$csv = new CSVExport($provider);


$csv->headers = array('execution_date'=>'Date','topik'=>'Topik','id_media_seller'=>'Media Seller','id_advertiser'=>'Advertiser','id_product_category'=>'Product Category','id_group'=>'Group','price'=>'Price'); 


$csv->exportFull = true; 

$content = $csv->toCSV();

				

$filename = $title.'.csv';

Yii::app()->getRequest()->sendFile(basename($filename), $content, "text/csv",false);

exit();