Jump to content

insert timestamp onto database problem


2wasted

Recommended Posts

You need to convert the time in php to a format MySQL can recognise...

$date = time(); as suggested will not give you a valid date format in MySQL.  Do you just want a current timestamp, if so, use this:

[code]
<?php
$query = "INSERT INTO onlineform (name, Cname, email, query, Pnumber, date) VALUES ('$Name','$Cname','$email','$Query', '$Pnumber', now())";
?>
[/code]

Regards
Huggie
Link to comment
Share on other sites

[quote author=HuggieBear link=topic=110633.msg447650#msg447650 date=1160090791]
You need to convert the time in php to a format MySQL can recognise...

$date = time(); as suggested will not give you a valid date format in MySQL.  Do you just want a current timestamp, if so, use this:

[code]
<?php
$query = "INSERT INTO onlineform (name, Cname, email, query, Pnumber, date) VALUES ('$name','$Cname','$email','$Query', '$Pnumber', now())";
?>
[/code]

Regards
Huggie
[/quote]
i think you have hit the nail on the head:-)it displays on the page but does not go in to the datamase(MYSQL)
Link to comment
Share on other sites

[quote author=HuggieBear link=topic=110633.msg447653#msg447653 date=1160091253]
OK, so like I said, do you want a current timestamp in the timestamp field?

MySQL's [b]now()[/b] function will do that, see my code above.

Huggie
[/quote]
cheers m8,
works!!:-)
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.