Yii Framework Forum: I Have Two Question About Data Export To Csv Format File - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

I Have Two Question About Data Export To Csv Format File Rate Topic: -----

#1 User is offline   bingyu206 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 15-February 13

Posted 15 February 2013 - 09:55 PM

I'm new to Yii. So I have 2 questions:

1.I'm chinese,so I export data to CSV format about encode question.Please ask me how to set the code about CSV format file?

2.Automatically set the code into the page format, derived data only 10($csv->exportCurrentPageOnly();Is set for this function, should how to set??)

Post code, consult everybody


$sql = 'SELECT b.nick, b.rated_nick, b.item_title, b.item_price, b.content, b.reply FROM `voc_rate_result` a,`voc_rate_detail` b
WHERE a.tb_user_id = b.tb_user_id
AND a.id = b.rate_id
AND a.is_process=4';
$res = Yii::app()->db->createCommand($sql)->query();

$dataProvider=new CSqlDataProvider($sql, array(
'totalItemCount'=>$count,
'pagination'=>array(
'pageSize'=>10,
),
));



$filename = 'save.csv';
$csv = new ECSVExport($dataProvider);
$csv->exportCurrentPageOnly(); // if not set will loop through all pages!
$csv->setOutputFile($filename);
$csv->toCSV($filename);
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users