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
[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)
[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!!:-)

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.