Hello! I have 3 HTML drop down menus which have different choices depending on the date. For example, they can choose January - December, 0-12 for the month, and 0-31 for the day. I want to take their info, convert it in date format (is this such a thing?) and insert it into a DATE field in MySQL.
In MySQL-Front the column is represented as 00-00-0000. How do I insert the date that they selected?
Finally, I need to run some for of query like this:
SELECT * FROM table (where the date is between this and this)
How would I run that?
Inserting a DATE into a MySQL DATE field
Moderator: General Moderators
For inserting the date(which is represented by 0000-00-00) I would look at implode(). You can implode the 3 values that each of the drop-down menus. Heres an example:
For your second question, I have seen examples like that at MySQL.com. Try looking around here.
Code: Select all
<?php
$year=2003;
$month=06;
$day=30;
$datearray = array('$year', '$month', '$day');
$date = implode("-", $datearray);
echo $date; // 2003-06-30
?>