I am trying to make a new Register script. But now, there is only one thing that is not working.. I can't make the following query work.mysql_query("INSERT INTO members(username, password, email, register_date) VALUES ('$user','$pass','$email', '$reg_date')") or die("Failed to register.<br> Error:".mysql_error());
this is the current date variable, that is causing the error. (if I remove it from the query, it works just fine)$reg_date=date("Y/m/d");
this is the error I am getting:
Error:Data truncated for column 'register_date' at row 1
in the database I gave it the data type int, because the date is only made out of numbers.
Thanks for your help //Feelay
Your query don't work because your variable stores a string like "2008/06/13", the "/" character cause this error to happen.
To fix it simply change your variable's date format to:<?php$reg_date=date("Ymd");?>But this can lead to get problems with the register_date field, i'm not sure about this.
A better solution is to change the data type of the register_date field to date and change the sql query to:<?phpmysql_query("INSERT INTO members(username, password, email, register_date) VALUES ('$user','$pass','$email', NOW())") or die("Failed to register.<br> Error:".mysql_error());?>Best regards,
I forgot that "/" was in the variable :PAnyways.. it is working now =) Thank you //Feelay
|VIEW DESKTOP VERSION||REGISTER||GET FREE HOSTING|