• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Database class odity/bug

#1
[eluser]MyBelovedPHP[/eluser]
Seems that you can't do:

Code:
$sql = "SELECT *,lpad(id,8,'0') as id2 from table ORDER BY id2 DESC";
$query = $this->db->query($sql);
foreach ($query->result() as $row){

Just a white screen, no output at all, my controller simply ends.
The Select *, lpad(id,8,'0') as id2 seems to be the problem, when looping the foreach.

If I write out all column names (no *), i don't experience a problem.

The query is proper SQL though and will run everywhere, but not in CI.
Must be a bug somewhere in $query->result() as $row
FYI: I use it in a model class.
Can anyone confirm?

Debug shows:
DEBUG - 2007-10-22 12:47:33 (mem: 274.47) --> Config Class Initialized
DEBUG - 2007-10-22 12:47:33 (mem: 274.16) --> Hooks Class Initialized
DEBUG - 2007-10-22 12:47:33 (mem: 383.11) --> No URI present. Default controller set.
DEBUG - 2007-10-22 12:47:33 (mem: 383.20) --> Router Class Initialized
DEBUG - 2007-10-22 12:47:33 (mem: 446.55) --> Output Class Initialized
DEBUG - 2007-10-22 12:47:33 (mem: 601.65) --> Input Class Initialized
DEBUG - 2007-10-22 12:47:33 (mem: 603.51) --> Global POST and COOKIE data sanitized
DEBUG - 2007-10-22 12:47:33 (mem: 650.05) --> URI Class Initialized
DEBUG - 2007-10-22 12:47:33 (mem: 671.36) --> Language Class Initialized
DEBUG - 2007-10-22 12:47:33 (mem: 930.20) --> Loader Class Initialized
DEBUG - 2007-10-22 12:47:33 (mem: 1,438.46) --> Database Driver Class Initialized
DEBUG - 2007-10-22 12:47:33 (mem: 1,437.66) --> Controller Class Initialized
DEBUG - 2007-10-22 12:47:33 (mem: 1,527.48) --> Helpers loaded: url
DEBUG - 2007-10-22 12:47:33 (mem: 1,635.26) --> Model Class Initialized
DEBUG - 2007-10-22 12:47:34 (mem: 274.40) --> Config Class Initialized
DEBUG - 2007-10-22 12:47:34 (mem: 274.23) --> Hooks Class Initialized
DEBUG - 2007-10-22 12:47:34 (mem: 383.11) --> No URI present. Default controller set.
DEBUG - 2007-10-22 12:47:34 (mem: 383.20) --> Router Class Initialized
DEBUG - 2007-10-22 12:47:34 (mem: 446.55) --> Output Class Initialized
DEBUG - 2007-10-22 12:47:34 (mem: 601.65) --> Input Class Initialized
DEBUG - 2007-10-22 12:47:34 (mem: 603.51) --> Global POST and COOKIE data sanitized
DEBUG - 2007-10-22 12:47:34 (mem: 650.05) --> URI Class Initialized
DEBUG - 2007-10-22 12:47:34 (mem: 671.36) --> Language Class Initialized
DEBUG - 2007-10-22 12:47:34 (mem: 930.20) --> Loader Class Initialized
DEBUG - 2007-10-22 12:47:34 (mem: 1,438.46) --> Database Driver Class Initialized
DEBUG - 2007-10-22 12:47:34 (mem: 1,437.66) --> Controller Class Initialized
DEBUG - 2007-10-22 12:47:34 (mem: 1,527.48) --> Helpers loaded: url
DEBUG - 2007-10-22 12:47:34 (mem: 1,635.26) --> Model Class Initialized
DEBUG - 2007-10-22 12:47:35 (mem: 274.40) --> Config Class Initialized
DEBUG - 2007-10-22 12:47:35 (mem: 274.23) --> Hooks Class Initialized
DEBUG - 2007-10-22 12:47:35 (mem: 383.11) --> No URI present. Default controller set.
DEBUG - 2007-10-22 12:47:35 (mem: 383.20) --> Router Class Initialized
DEBUG - 2007-10-22 12:47:35 (mem: 446.55) --> Output Class Initialized
DEBUG - 2007-10-22 12:47:35 (mem: 601.65) --> Input Class Initialized
DEBUG - 2007-10-22 12:47:35 (mem: 603.51) --> Global POST and COOKIE data sanitized
DEBUG - 2007-10-22 12:47:35 (mem: 650.05) --> URI Class Initialized
DEBUG - 2007-10-22 12:47:35 (mem: 671.36) --> Language Class Initialized
DEBUG - 2007-10-22 12:47:35 (mem: 930.20) --> Loader Class Initialized
DEBUG - 2007-10-22 12:47:35 (mem: 1,438.46) --> Database Driver Class Initialized
DEBUG - 2007-10-22 12:47:35 (mem: 1,437.66) --> Controller Class Initialized
DEBUG - 2007-10-22 12:47:35 (mem: 1,527.48) --> Helpers loaded: url
DEBUG - 2007-10-22 12:47:35 (mem: 1,635.26) --> Model Class Initialized
DEBUG - 2007-10-22 12:47:35 (mem: 274.41) --> Config Class Initialized
DEBUG - 2007-10-22 12:47:35 (mem: 274.24) --> Hooks Class Initialized
DEBUG - 2007-10-22 12:47:35 (mem: 383.13) --> No URI present. Default controller set.
DEBUG - 2007-10-22 12:47:35 (mem: 383.22) --> Router Class Initialized
DEBUG - 2007-10-22 12:47:35 (mem: 446.56) --> Output Class Initialized
DEBUG - 2007-10-22 12:47:35 (mem: 601.66) --> Input Class Initialized
DEBUG - 2007-10-22 12:47:35 (mem: 603.52) --> Global POST and COOKIE data sanitized
DEBUG - 2007-10-22 12:47:35 (mem: 650.06) --> URI Class Initialized
DEBUG - 2007-10-22 12:47:35 (mem: 671.38) --> Language Class Initialized
DEBUG - 2007-10-22 12:47:35 (mem: 930.22) --> Loader Class Initialized
DEBUG - 2007-10-22 12:47:35 (mem: 1,438.48) --> Database Driver Class Initialized
DEBUG - 2007-10-22 12:47:35 (mem: 1,437.68) --> Controller Class Initialized
DEBUG - 2007-10-22 12:47:35 (mem: 1,527.50) --> Helpers loaded: url
DEBUG - 2007-10-22 12:47:35 (mem: 1,635.27) --> Model Class Initialized
DEBUG - 2007-10-22 12:47:36 (mem: 274.41) --> Config Class Initialized
DEBUG - 2007-10-22 12:47:36 (mem: 274.24) --> Hooks Class Initialized
DEBUG - 2007-10-22 12:47:36 (mem: 383.13) --> No URI present. Default controller set.
DEBUG - 2007-10-22 12:47:36 (mem: 383.22) --> Router Class Initialized
DEBUG - 2007-10-22 12:47:36 (mem: 446.56) --> Output Class Initialized
DEBUG - 2007-10-22 12:47:36 (mem: 601.66) --> Input Class Initialized
DEBUG - 2007-10-22 12:47:36 (mem: 603.52) --> Global POST and COOKIE data sanitized
DEBUG - 2007-10-22 12:47:36 (mem: 650.06) --> URI Class Initialized
DEBUG - 2007-10-22 12:47:36 (mem: 671.38) --> Language Class Initialized
DEBUG - 2007-10-22 12:47:36 (mem: 930.22) --> Loader Class Initialized
DEBUG - 2007-10-22 12:47:36 (mem: 1,438.48) --> Database Driver Class Initialized
DEBUG - 2007-10-22 12:47:36 (mem: 1,437.68) --> Controller Class Initialized
DEBUG - 2007-10-22 12:47:36 (mem: 1,527.50) --> Helpers loaded: url
DEBUG - 2007-10-22 12:47:36 (mem: 1,635.27) --> Model Class Initialized
DEBUG - 2007-10-22 12:47:37 (mem: 274.43) --> Config Class Initialized
DEBUG - 2007-10-22 12:47:37 (mem: 274.26) --> Hooks Class Ini


Messages In This Thread
Database class odity/bug - by El Forum - 10-22-2007, 04:51 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.