PHP Questions Home

Categories

Arrays
Files
Forms
Functions
Images
MySQL
Numbers
Others
Strings
Website


PHP Functions

PHP Functions


More PHP

Top Questions
Ask a Question

How do I access the current time with mysql?


Another common query is to get to the current time in addition to the date within mysql.

When you want to log when something happens - for instance a post to your message board, this will be a particularly useful thing to know.

With the current time and date you will need to use NOW() like so:

<?php
$update 
mysql_query("UPDATE my_users SET lastlogin = NOW() WHERE username = 'elvis'");
?>



More mysql PHP Questions

How do I order the results of my query?
How do I group the results of a mysql query?
How do I set a default value for ENUM fields in PHP?
How do I return a random row from the database?
How do I include a conditional in my mysql query?