Page 1 of 1

Date field not accepting value

Posted: Mon Sep 13, 2004 10:09 pm
by Bobo the Bugbear
feyd | Please use

Code: Select all

tags when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]


I pull the date (ex September 13, 2004) inputted into a box from a form. This is called $tdate. I then break this up to get the month, day & year to input into the DB. The DB (MysQL) field is a date (format is 0000-00-00) type. When the input code is executed all values but the date are placed into the DB even though it is specified to do so. The value to be inputted is $completeDate. When I echo it, I get the correct date in the format 0000-00-00.  Anyone see what may be the cause of the date not being inputted?

Code: Select all

$getDate = explode(" ", $tdate);
$month = array_slice($getDate,0,1);
$year = array_slice($getDate,2,2);

$getDay = explode(",",$tdate);
$dayO = array_slice($getDay,0,1);

$dayN = explode(" ",$dayO[0]);
$day = array_slice($dayN,1,1);

$newMonth = date("m", mktime(0, 0, 0, $month[0], 0, $year[0]));
$completeDate = date("Ynm", mktime(0, 0, 0, $month[0], $day[0], $year[0]));

//1 - normal
//2 - urgent

if ($id == 0) {

$runQuery ("INSERT INTO todo (name, description, date, time, priority, month, year, finished)".
"VALUES ('$name', '$message', $completeDate, '$time', '$priority', '$newMonth', '$year[0]', 1)");
Don't comment on the $runQuery. This has been defined in a global file & is accurate.


feyd | Please use

Code: Select all

tags when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]

Posted: Mon Sep 13, 2004 10:58 pm
by fresh
could you use UPDATE instead of INSERT?

Posted: Mon Sep 13, 2004 11:42 pm
by feyd
post the rendered query line please.

Posted: Tue Sep 14, 2004 5:09 pm
by Bobo the Bugbear
what is a "rendered query line"

Posted: Tue Sep 14, 2004 5:11 pm
by feyd
echo the query string