Page 1 of 1

Insert Date

Posted: Tue Jan 20, 2004 8:57 am
by AliasBDI
I have some code which I thought would enter the current date and time into a field called "signup_date". Can someone check my query to figure out where the bad code is?

Code: Select all

$sql = mysql_query("INSERT INTO users (first_name, last_name, email_address, username, password, signup_date, decrypted_password, address, city, state, zip, phone1, phone2, dl, birth, newsletter, active)
		VALUES('$first_name', '$last_name', '$email_address', '$username', '$password_encrypt', now(), '$password', '$address', '$city', '$state', '$zip', '$phone1', '$phone2', '$dl', '$birth', '$newsletter', '$active')") or die (mysql_error());

Posted: Tue Jan 20, 2004 9:22 am
by twigletmac
Is there an error? What exactly is going wrong?

Mac

Posted: Tue Jan 20, 2004 9:28 am
by Slyvampy
"now()"

try putting ' around it ?

response

Posted: Tue Jan 20, 2004 9:36 am
by AliasBDI
twigletmac-
The problem is that it does not put anything in the field so the field goes to default - December 1969 ....

Slyvampy-
I tried the quotations but it did not work either. Same result.

Posted: Tue Jan 20, 2004 9:59 am
by twigletmac
What type of field is signup_date?

Mac

Posted: Tue Jan 20, 2004 11:09 am
by AliasBDI
The field is "datetime" field.

aiight

Posted: Wed Jan 21, 2004 2:27 pm
by AliasBDI
Got it working... might have been a dumb user error. :wink: