| | |
timestamp help?
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
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.
What is the error? do this
It will tell you the error
mysql_query($sql) or die(mysql_error());It will tell you the error
GCS d- s+ a-->? C++(++++) UL+++ P+>+++ L+++ E--- W+++
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
•
•
Join Date: Sep 2007
Posts: 11
Reputation:
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())";
![]() |
Similar Threads
- Is The Gov't Getting Rid Of Cash And Coins (Geeks' Lounge)
- 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)
- Trojan: IRC/SdBot.AFN (Viruses, Spyware and other Nasties)
- Efficient Programming (Computer Science)
- 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?
| Thread Tools | Search this Thread |
# 5.2.10 ajax apache api array beginner binary broken cakephp checkbox class clean clients cms code cron curl database date display dissertation dynamic echo echo$_get[x]changingitintovariable... email error file files folder form forms function functions google href htaccess html image images include insert integration ip java javascript joomla ldap legislation limit link local login loop mail memberships menu mlm multiple mysql mysqlquery oop open paypal pdf persist php problem query radio random recursion regex remote rss script search server sessions sms soap sockets source space spam sql syntax system table tutorial update upload url validation validator variable video web xml youtube






