$query = "INSERT INTO users (first_name, last_name, email, password, registration_date) VALUES ('$fn', '$ln', '$e', SHA('$p'), NOW() )";

What is the NOW() used for. Is it compulsory?

Recommended Answers

All 3 Replies

It would fill 'registration_date' column in this code.
It depends on:
1)your table structure.
2)your SQL query.

In the first case, SQL would return an error if you don't fill that column.
In the second case, it should be used if you formated your query to include 'registration_date'.

The NOW() function might return the current date which uses the php time functions.

Good luck.

For detailed information check MySQL Manual.

You can also use PHP's date() function instead of NOW().

Thanks all.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.