Re: [PHP-DB] date problems

2007-09-07 Thread Instruct ICC
From: rDubya [EMAIL PROTECTED] Thanks for the help so far guys!! Not helping though. I have the date contained in the database as timestamp (-MM-DD HH:MM:SS). Do you really need to pull events from the database which are not in your range of interest? This will only slow down your

Re: [PHP-DB] date problems

2007-09-07 Thread Instruct ICC
From: Instruct ICC [EMAIL PROTECTED] And while not trusting your indexing, rewrite short_date as: My short_date rewrite was also wrong. So it looks like you will have to learn those offsets for this function if you do it on the PHP side. But you could also do it on the MySQL side.

Re: [PHP-DB] date problems

2007-09-07 Thread Graham Cossey
This DID work, but I recently switched hosting companies... Is the new server in a different country with a different date format / time zone? Just a thought ;-\ On 9/7/07, Instruct ICC [EMAIL PROTECTED] wrote: From: Instruct ICC [EMAIL PROTECTED] And while not trusting your indexing,

Re: [PHP-DB] date problems

2007-09-07 Thread rDubya
WOW!! Thanks for all the help guys!! And Instruct ICC.. you're solution for pulling the events did work.. but.. it turns out that the solution was actually much simpler than I thought: The old mysql database (once again, not sure what version) stored the date as MMDDHHMMSS. The new

[PHP-DB] date problems

2007-09-06 Thread rDubya
I'm having a problem with dates in php and mysql. I run a site that promotes dated events and concerts and has the information for each stored in a mysql database with the timestamp field. Here is the function that checks the date of the event to ensure it is between now and three weeks from now

RE: [PHP-DB] date problems

2007-09-06 Thread Instruct ICC
From: rDubya [EMAIL PROTECTED] My problem is that I have events dated for Sep 2007 and on, and yet they all come up as being on Dec 7 to 9, 2006.. any ideas? rDubya How about having MySQL only return the events you are interested in? SELECT yourEventFields FROM theTable WHERE TO_DAYS(

Re: [PHP-DB] date problems

2007-09-06 Thread Mike Gohlke
It's much better to use add_date instead of to_days since mysql isn't smart enough to do it for you. Such as: SELECT yourEventFields FROM theTable WHERE theEventDate BETWEEN now() AND date_add(now(), INTERVAL 21 DAYS; This way mysql will calc the now() and date_add and will essentially convert

Re: [PHP-DB] date problems

2007-09-06 Thread Mike Gohlke
Argh, make sure you add the closing paren for the date_add since I forgot it. Mike... Mike Gohlke wrote: It's much better to use add_date instead of to_days since mysql isn't smart enough to do it for you. Such as: SELECT yourEventFields FROM theTable WHERE theEventDate BETWEEN now() AND

Re: [PHP-DB] date problems

2007-09-06 Thread rDubya
Thanks for the help so far guys!! Not helping though. I have the date contained in the database as timestamp (-MM-DD HH:MM:SS). The problem is that not only is it not displaying events, but if I alter my code so that it displays ALL events, it shows the events for the last year, and those