Current location: Hot Scripts Forums » Other Discussions » Database » datetime data type problem...

datetime data type problem...

 
Prev Previous Post   Next Post Next
  #1  
Old 10-04-06, 06:32 PM
Clark_Kent's Avatar
Clark_Kent Clark_Kent is offline
Newbie Coder
 
Join Date: Mar 2006
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
datetime data type problem...

Hi Everyone,

I have a form that submits data into a database with the use of PHP. I have a hidden form element that I created in order to input the current date and time into the database using the now() function once the form has been submitted (i'm using MySQL). The problem i'm experiencing is when the form has been submitted and the necessary form data is placed into the database, the datetime field is set to zeros instead of the current date and time - it displays 0000-00-00 00:00:00.

Input field looks like this...

Code:
<input type="hidden" name="dateJoined" value="now()"  />
The corresponding PHP code that deals with this specific control is the following...

Code:
GetSQLValueString($_POST['dateJoined'], "date")
The PHP code above i took out of the VALUES part of the SQL query. I know something is being sent to the datetime field in the database because it displays a series of zeros, I'm just not sure why it doesn't accept the current time and date from the now() function. When i enter the following query...

Code:
UPDATE databaseName.tableName SET dateJoined = now();
the above works, it updates the datetime field with the current date and time. So at least the now() function does input the correct data.

Any idea what I'm doing wrong?

Thanks for your time,

- CK
Reply With Quote
 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Default value for the Datetime data type... Clark_Kent Database 2 08-09-06 08:40 AM
visual basic problem I cannot solve: data grid : need vb programmer for hire chrismonroe10 Visual Basic 1 03-25-05 07:42 PM
Problem getting data from DataGrid on update petersza ASP.NET 5 10-20-04 12:37 AM


All times are GMT -5. The time now is 07:49 PM.
vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.2 (Unregistered)