Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Jun 25th, 2007, 5:54 AM   #1
Satans_Banjo
Newbie
 
Join Date: Oct 2006
Posts: 15
Rep Power: 0 Satans_Banjo is on a distinguished road
Entering DATETIME values with PHP

Hi

I'm pretty new to PHP/MySQL and I am having trouble entering dates into a database. I've got the database set up and one of the fields is a DATETIME field. What I want to do is put the time that the record was entered into that file. This is what I'm currently doing, but it leaves the date as the default value in the database (0000-00-00 00:00:00):

[PHP]$phpTime = time();
$mySqlTime = gmdate("YYYY-mm-dd H:m:s", $phpTime);
$dateAdded = strtotime($mySqlTime . " GMT");[/PHP]

Is that completely wrong or am I just missing something trivial and/or blindingly obvious?

Thanks,

Banjo
Satans_Banjo is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

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 On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Php with Sun Java System Application Server Platform lucifer PHP 0 Jun 7th, 2007 4:03 AM
Classes in PHP kruptof PHP 9 May 11th, 2007 9:44 PM
C# Datetime data types King C# 2 Jun 4th, 2006 11:21 PM
Returning two values Navid C 19 Jun 13th, 2005 2:57 AM
Problem Inserting Values into mySQL from PHP stakeknife PHP 1 Mar 23rd, 2005 8:45 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:10 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC