updating date field

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am trying to do an update. but for some reason the date is being lost in
the process.

 

Among other things, my form has three html <selects> one for month (eMonth),
one for day (eDay) and one for year (eYear).  This is the code that does the
processing:

 

 

<code>

 

if (isset($_POST['eMonth']) && $_POST['eMonth'] != '')

$eMonth = $_POST['eMonth'];

else $eMonth = '01';

                                    

if (isset($_POST['eDay']) && $_POST['eDay'] != '')

            $eMonth = $_POST['eDay'];

else $eMonth = '01';

                                    

if (isset($_POST['eYear']) && $_POST['eYear'] != '')

            $eYear = $_POST['eYear'];

else $eYear = '2007';

                                    

<.processing the rest of the form fields.>

 

 

$updateEventQuery = "UPDATE events SET EventDate = '$eYear-$eMonth-$eDay',
AppliedFYE = '$appliedFYE', LocationID = '$eLocation', StartTime =
'$eHour:$eMin $eAMPM', Type = '$eType', Format = '$eFormat', Description =
'$eDescription', EventApproved = '$eApproved', EventOfficial = '$eOfficial',
LastUpdateBy = '".$_SESSION['ContactID']."' WHERE EventID =
'".$_GET['eventid']."'";

 

Echo $updateEvetQuery;

                                    

//  $updateEventResult = mysql_query($updateEventQuery);

 

</code>

 

When I run this, the query string it prints out is: 

 

UPDATE events SET EventDate = '2006-10-10', AppliedFYE = '2007', LocationID
= '14', StartTime = '5:00 PM', Type = '3', Format = 'BOARD', Description =
'Regular board meeting', EventApproved = '1', EventOfficial = '0',
LastUpdateBy = '209' WHERE EventID = '54'

 

When this query is actually run on the DB though, it queries with no errors,
and all the data is saved/updated properly *except* the date - it becomes
0000-00-00.

 

Am I missing something?

 

 

Thanks in advance,

 

-J

 

 

 

 

 


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux