Welcome Guest, Not a member yet? Register   Sign In
codeigniter active record bug?
#6

[eluser]JHackamack[/eluser]
[quote author="noctrum" date="1263506176"]Tried this locally and both queries work fine for me, I think your problem is something else.

Code:
$this->load->database();
$res = $this->db->select("some_data, DATE_FORMAT(start_date, '%d %b, %Y'), DATE_FORMAT(end_date, '%d %b, %Y')", false)->get('test_table')->result();
echo "<xmp>";
foreach($res as $row){
    echo print_r($row, true);
}
echo "</xmp>";

Quote:stdClass Object
(
[some_data] => Test data A
[DATE_FORMAT(start_date, '%d %b %Y')] => 14 Jan, 2010
[DATE_FORMAT(end_date, '%d %b %Y')] => 14 Jan, 2010
)
stdClass Object
(
[some_data] => Test data B
[DATE_FORMAT(start_date, '%d %b %Y')] => 14 Jan, 2010
[DATE_FORMAT(end_date, '%d %b %Y')] => 14 Jan, 2010
)
stdClass Object
(
[some_data] => Test data C
[DATE_FORMAT(start_date, '%d %b %Y')] => 14 Jan, 2010
[DATE_FORMAT(end_date, '%d %b %Y')] => 14 Jan, 2010
)
stdClass Object
(
[some_data] => Test data D
[DATE_FORMAT(start_date, '%d %b %Y')] => 14 Jan, 2010
[DATE_FORMAT(end_date, '%d %b %Y')] => 14 Jan, 2010
)
[/quote]

The problem that i see is all your dates are formatted the same way in the result, even though you specified a different format in date_format.

AKA:
%d %b %Y returns 14 Jan, 2010 in your result (where did the comma come in)


Messages In This Thread
codeigniter active record bug? - by El Forum - 01-13-2010, 09:58 AM
codeigniter active record bug? - by El Forum - 01-13-2010, 10:55 AM
codeigniter active record bug? - by El Forum - 01-13-2010, 08:30 PM
codeigniter active record bug? - by El Forum - 01-13-2010, 08:33 PM
codeigniter active record bug? - by El Forum - 01-14-2010, 09:56 AM
codeigniter active record bug? - by El Forum - 01-14-2010, 10:20 AM
codeigniter active record bug? - by El Forum - 01-14-2010, 10:27 AM



Theme © iAndrew 2016 - Forum software by © MyBB