CodeIgniter Forums
Problem with to_excel helper under CI 2.1.0 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Problem with to_excel helper under CI 2.1.0 (/showthread.php?tid=47440)



Problem with to_excel helper under CI 2.1.0 - El Forum - 12-08-2011

[eluser]Ornis[/eluser]
I used to_excel helper (plugin) several times before. However, with version CI 2.1.0 I get errors running the following code:

Code:
public function excel() {
$this->load->helper('to_excel');
$query = $this->db->get('user');
        to_excel($query,'my_excel');
}

The error msg is:

A PHP Error was encountered

Severity: Notice

Message: Undefined property: stdClass::$Type

Filename: mysql/mysql_result.php

Line Number: 89

Any hints? What do I miss here? Thanks.


*******
P.S.
Above code runs perfectly after downgrading system folder to CI 2.0



Problem with to_excel helper under CI 2.1.0 - El Forum - 02-02-2012

[eluser]bwamba[/eluser]
I know this isn't the most elegant solution, but defining your environment as 'production' instead of 'development' solves the issue.

In index.php, change

Code:
define('ENVIRONMENT', 'development');

to

Code:
define('ENVIRONMENT', 'production');



Problem with to_excel helper under CI 2.1.0 - El Forum - 02-02-2012

[eluser]Bhashkar Yadav[/eluser]
please look at same post http://ellislab.com/forums/viewthread/186762/#884700. it may help you.


Problem with to_excel helper under CI 2.1.0 - El Forum - 02-02-2012

[eluser]bwamba[/eluser]
Thanks for the link, but that thread looks like it's pre-2.1.0.


Problem with to_excel helper under CI 2.1.0 - El Forum - 02-04-2012

[eluser]bwamba[/eluser]
I figured it out.

Replace

Code:
$query->field_data();

with

Code:
$query->list_fields();

and replace

Code:
$field->name

with

Code:
$field