I have a problem downloading all the data from the database and throw them into cvs in more or less this way:
Yii::import('ext.ECSVExport');
$command = Yii::app()->db->createCommand('SELECT * FROM table_name WHERE Id = $id');
$export = new ECSVExport($command);
$data = $export->toCSV();
Yii::app()->getRequest()->sendFile('sales_order.csv', $data, "text/csv", false);
my database table looks something like this
id O_NUMBER O_TYPE O_VAR1 O_VAR2 O_VAR3
That's the problem with the export gets the title names of the tables from the database and not, for example:
id NUMBER TYPE VAR1 VAR2 VAR3