Free Web Hosting is Powered by HOST1PLUS

Archive for the ‘MySQL’ Category

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:

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

How can I show an image from MySQL?

You can store a image in a database making the database table field of BLOB type. Later you can query the database fecth the content of image as usual and display this fetched-image on a webpage (or whatever the way like) using PHP headers.

What is MySQL hostname?

The hostname of your MySQL database is ‘localhost’. You will find also this information when you create any database in DirectAdmin server control panel.