Jump to content

Date() Won't Save Corrrectly To My Mysql Database. (fixed)


MrFish
 Share

Recommended Posts

I have a working registration form but I'm trying to add a date of registration column. I'm using the date() function and when I echo it out it looks fine but when I try to save it to my mysql database it doesn't work. Note that I've tried it 2 ways. I've first tried it by setting it to a variable then by putting it directly into the query. Either way, it still doesn't save correctly.badregister.png

$query = 'INSERT INTO users VALUES("' . $id . '", "' . $username . '", "' . $password . '", "' .  $email . '", "' . $server . '", "' . $ign . '", "' . date("m-d-y") . '", "' . $ip . '")';		mysql_select_db("b17_3648160_sitedb", $con) or die(mysql_error());		mysql_query($query);		$affected = mysql_affected_rows();

EDIT:Figured it out. That was stupid of me; instead of being m-d-y it should have been y-m-d.

Edited by MrFish
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...