"Roger Smith" <roger@ns_jadebox.com> wrote in message
news:9i*******************@twister.tampabay.rr.com ...
Could someone explain, even using pseudo code, how to take a text input
I have set up as YYYY-MM-DD using php, and convert to a value mysql will
insert into a Date (not timestamp, not datetime) field.
MySQL has no problem with dates in "YYYY-MM-DD" format.
For example,
$result = mysql_query("insert into test (created) values
('2003-07-11')");
-- Roger
http://www.harrynilsson.com/
Yes, I know. I did mention a lump of 4x2...
My prblem was not the format after all(obiously), but the way I was trying
to check if the date had already been entered.
What I tried to do, was use in_array, to compare my date with those already
in the table.
(I didn't realize that it wouldn't work unless using strict, which I have
not yet understood in full)
This then had me Assuming I had the format wrong ;)
Ended up using:
$queryNewTest = "select compDate from tbl_competition where compDate =
'$concatDate'";
$resultNewTest = mysql_query($queryNewTest) or die("Query failed
:-".MYSQL_ERROR());
$numNewRows = mysql_num_rows($resultNewTest);
$textNewDate = formatdate($concatDate);
if ($numNewRows){
$newTextAlert = " <b class=\"alert\">$textNewDate</b> already exists";
echo $newTextAlert;
}
else {
$newOkDate = "Will enter $textNewDate into system.";
echo $newOkDate;
}
$concatDate is my string taken from 3 text boxes, checked, and joined.
formatdate() is a function found on php.net user comments, and turns date
into format
Tuesday, 22 Apr 2003
else section will ultimately contain insert statement... but not this
morning, 2:15am... I'm going to bed.
Thanks for replying.
Regards
PhilM