How do I get the current time? What I am trying to do is insert the current time the script is run, along with a few other things into the database for retrieving later. I thought that the function now() did it but I guess not because when I use my database read script I get a bunch of:
0000-00-00 00:00:00
Thanks for the help! 🙂
What was your query?
You could also use PHP to obtain the time and insert it.
$query = "INSERT INTO $tablename values ('','$ip','now()')";
The third value 'now()' is where I want the current time to be placed. I thought that now() returned the current time but I guess I am wrong. What can I use to get the current time?
remove the single quotes.
Originally posted by laserlight remove the single quotes.
Thanks a lot!!!! Should I always never use quotes when using functions in queries?
Well, the thing is that your DB function was interpreted as a string, so it didnt work.
Originally posted by laserlight Well, the thing is that your DB function was interpreted as a string, so it didnt work.
Ohhhhh. Ok. That was my first MySQL program. Thanks a bunch!!!!! 🙂