Jump to content


Photo

inserting time


  • Please log in to reply
3 replies to this topic

#1 desithugg

desithugg
  • Members
  • PipPipPip
  • Advanced Member
  • 281 posts
  • LocationScarborough

Posted 05 August 2006 - 10:38 PM

umm i have a field in one of my tables called
field:postDate
type:datetime
default:0000-00-00 00:00:00

umm if i wanna insert time in there using a quesry how can i do so

#2 king arthur

king arthur
  • Members
  • PipPipPip
  • Advanced Member
  • 335 posts
  • LocationUK HQ

Posted 05 August 2006 - 10:42 PM

If you mean the current time you are running the query, use NOW()
Sir Isaac Newton said "If I have seen farther, it is by standing on the shoulders of giants". But it is not recorded as to whether he said it before or after he was hit on the head by a falling apple.

#3 desithugg

desithugg
  • Members
  • PipPipPip
  • Advanced Member
  • 281 posts
  • LocationScarborough

Posted 05 August 2006 - 10:42 PM

o kk thanx

#4 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 05 August 2006 - 10:45 PM

You can do  it like this.

$sql= mysql_query("INSERT INTO yourtable(postdate) VALUES (now())") or die (mysql_error());

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users