HuggieBear Posted October 5, 2006 Share Posted October 5, 2006 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]RegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/23122-insert-timestamp-onto-database-problem/page/2/#findComment-104683 Share on other sites More sharing options...
redarrow Posted October 5, 2006 Share Posted October 5, 2006 $showdate = date('M j, Y g:i A');$showdate=strtotime($showdate); Quote Link to comment https://forums.phpfreaks.com/topic/23122-insert-timestamp-onto-database-problem/page/2/#findComment-104684 Share on other sites More sharing options...
2wasted Posted October 5, 2006 Author Share Posted October 5, 2006 [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]RegardsHuggie[/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 Link to comment https://forums.phpfreaks.com/topic/23122-insert-timestamp-onto-database-problem/page/2/#findComment-104685 Share on other sites More sharing options...
HuggieBear Posted October 5, 2006 Share Posted October 5, 2006 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 Link to comment https://forums.phpfreaks.com/topic/23122-insert-timestamp-onto-database-problem/page/2/#findComment-104686 Share on other sites More sharing options...
redarrow Posted October 5, 2006 Share Posted October 5, 2006 is your form name set to submit cheek ok. Quote Link to comment https://forums.phpfreaks.com/topic/23122-insert-timestamp-onto-database-problem/page/2/#findComment-104687 Share on other sites More sharing options...
2wasted Posted October 5, 2006 Author Share Posted October 5, 2006 [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!!:-) Quote Link to comment https://forums.phpfreaks.com/topic/23122-insert-timestamp-onto-database-problem/page/2/#findComment-104698 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.