Re: MySQL Date problem

From: Date: Mon, 03 Jul 2000 05:13:15 +0000
Subject: Re: MySQL Date problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-4436@lists.php.net to get a copy of this message
On 3 Jul, Stuart Cumming wrote: > I'm having a problem with MySQL and the rollover of the Unix timestamp (to > 10 digits) in my PHP scripts. > > A query "select * from $table where departure <= '999999999' " (select > all > those who left before Sep 8 2001) returns 70 records > but "select * from $table where departure <= '1000000000' " (select all > those who left before Sep 8 2001) returns 0 records > > In the database table 'departure' is a char field of 20 characters. > > Any hints appreciated. > > Regards, > > Stuart Cumming > stuart@phuket.com > www.phuket.com > > Please copy to e-mail. Thks. Your problem is that the departure field needs to be a numeric type to be able to successfully cmpare thse values in the manner you want. Remember that in a text sort, a string beginning with 1 will appear before a string beginning with 9, regardless of the length. (There are possibly exceptions to this which someone will remind me about) Cheers -- David Robley | WEBMASTER & Mail List Admin RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/ AusEinet | http://auseinet.flinders.edu.au/ Flinders University, ADELAIDE, SOUTH AUSTRALIA

« previous php.general (#4436) next »