I have a mysql database that has a date field and a time field.
I want users to be able to enter a date and a time in text boxes on an html
form and have them end up in the database.
Code examples would be good here. Either way, the format for a DATE field is YYYYMMDD or 'YYYY-MM-DD' and the format for a TIME field is HHMMSS or 'HH:MM:SS'. Make sure what you're trying to stick in the database is in that format. If you want to accept another format in your text fields, then you'll need to use date(), strtotime(), mktime(), explode(), etc to format it this way.
You really just need one DATETIME or TIMESTAMP field, though... there's reason to keep these values in two separate fields if they are related to the same event. It'll make searching down the road easier.
SELECT * FROM events WHERE datetimecolumn BETWEEN NOW() AND INTERVAL + 30 DAY;
SELECT * FROM events WHERE datetimecolumn BETWEEN 20040901 AND 20040930; etc...
---John Holmes...
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php