•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 456,488 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,735 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 824 | Replies: 4
![]() |
•
•
Join Date: Jan 2007
Posts: 6
Reputation:
Rep Power: 0
Solved Threads: 0
Please help I have been trying to insert a timestamp field into a DB. But to no avail.
Here's my code.
I am using a hidden field.
<input type="hidden" value="<? echo date("m-j-y g:i:s A"); ?>" name="time" />
Then on my action page, I do the following.
$stime=$_POST['time'];
then my insert statement looks like.
$sql="INSERT INTO $tbl_name(username, password, level, email,fname,lname,time)VALUES('$uname', '$pword', '$level','$email','$fname','$lname','$stime')";
I can insert without the time, but i need that. And i need it to be passed from a form field.
My DB set up is.
Column name of time. type is timestamp.
When I insert i receive an error. thats all it says.
Here's my code.
I am using a hidden field.
<input type="hidden" value="<? echo date("m-j-y g:i:s A"); ?>" name="time" />
Then on my action page, I do the following.
$stime=$_POST['time'];
then my insert statement looks like.
$sql="INSERT INTO $tbl_name(username, password, level, email,fname,lname,time)VALUES('$uname', '$pword', '$level','$email','$fname','$lname','$stime')";
I can insert without the time, but i need that. And i need it to be passed from a form field.
My DB set up is.
Column name of time. type is timestamp.
When I insert i receive an error. thats all it says.
•
•
Join Date: Apr 2005
Location: New York state
Posts: 487
Reputation:
Rep Power: 5
Solved Threads: 73
•
•
Join Date: Sep 2007
Posts: 11
Reputation:
Rep Power: 2
Solved Threads: 1
Why not just add a timestamp to the SQL statement?
I would also try to avoid using such names as time, date, etc for field names in a databases as this can cause problems.
For example:
$sql="INSERT INTO $tbl_name(username, password, level, email,fname,lname,time)VALUES('$uname', '$pword', '$level','$email','$fname','$lname', Now())";
I would also try to avoid using such names as time, date, etc for field names in a databases as this can cause problems.
For example:
$sql="INSERT INTO $tbl_name(username, password, level, email,fname,lname,time)VALUES('$uname', '$pword', '$level','$email','$fname','$lname', Now())";
![]() |
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- Timestamp (Shell Scripting)
- Adding minutes to a timestamp (PHP)
- how to add a timestamp to scrolling lines? (Shell Scripting)
- mIRC timestamp (Windows Software)
- Good Luck w/This one: Excel Question VBA/Macro/other (MS Access and FileMaker Pro)
- Is The Gov't Getting Rid Of Cash And Coins (Geeks' Lounge)
- Trojan: IRC/SdBot.AFN (Viruses, Spyware and other Nasties)
- Efficient Programming (Computer Science and Software Design)
- Redhat Linux 6.2 - ipop3d problem? (*nix Software)
Other Threads in the PHP Forum
- Previous Thread: Php
- Next Thread: How do I hide email recepients?


Linear Mode