Welcome Guest, Not a member yet? Register   Sign In
Extremely Wierd DATE based database error.
#1

[eluser]Shawty[/eluser]
Hi All, I'm posting here after a really frustrating few days trying to resolve the issue a describe below, anyone who might have any insight or ideas are greatly recived beacuse I've been writing code for best part of 30 years and this one's got me at a dead end.

I have a database table (A log of all phone calls recieved by an astresk pbx and inserted into MySql)

Each row in the DB has the following schema

Column Type
---------------------------------
recID int PK
name varchar(50)
msisdn varchar(15)
date date
time time

I have a code igniter install on the system (A Sun Netra Blade) that interrogates the DB and returns XML formatted data for consumation by down stream services and web apps.

The ci install is a standard controller/model/view layout, with the view being formatted as XML output from a PHP script that loops over data provided by a very basic controller calling a model to interrogate the MySql DB that lives on the same machine.

This all works very well except for one really strange thing.

Any dates AFTER 18th July 2010 are not returned by the Active record system in CI when i interrogete the DB. Previous to that date I have no problems, data is returned as expected.

Active record is putting the SELECT stament together correctly, beacuse if I use 'print_r' to dump the object and copy/paste the generated SQL directly into the MySql console it works perfectly and returns the expected data, but active record just cut's off after that date.

the php code in the model to get the data is:

$this->db->where('date =', $day);
$query = $this->db->get('callerlog');
if($query->numrows() > 0)
{
return $query->result_array();
}

Where $day is passed into the method in the following format YYYY-MM-DD which is exactly the same way as the date is stored in the database.

2010-07-18 or previous, data comes back perfectly and as expected.
2010-08-19 or after consistantly comes back with no records

SELECT * FROM callerlog WHERE date >= '2010-08-19' works perfectly fine from the MySql console or from PHP-MyAdmin, so I know it's not a DB thing, Iv'e definately pinned it down to Code Igniter itself, beacuse if I replace my Model code with normal standard MySql API calls I get back the data I expect every time.

Cheers

Shawty


Messages In This Thread
Extremely Wierd DATE based database error. - by El Forum - 11-28-2010, 06:43 AM
Extremely Wierd DATE based database error. - by El Forum - 11-28-2010, 08:23 AM
Extremely Wierd DATE based database error. - by El Forum - 11-28-2010, 01:13 PM
Extremely Wierd DATE based database error. - by El Forum - 11-29-2010, 06:39 AM
Extremely Wierd DATE based database error. - by El Forum - 11-30-2010, 01:58 PM



Theme © iAndrew 2016 - Forum software by © MyBB