Jump to content

[SOLVED] Problem with date being passed into mysql table


AirBoss36

Recommended Posts

I am building a game website and I am working on my user registration form.  Everything was working fine until I tried to add a function to include the registration date.  The form is processed and it looks like it has registered the user, but there is no entry placed into the database.

 


$join = date('Y-m-d');

mysql_query("INSERT INTO users (user_name, user_login, user_pw, user_email, user_bmonth, user_bday, user_byear, user_sex, join)
VALUES ('$name', '$login', '$pass', '$em', '$_POST[bmonth]', '$_POST[bday]', '$_POST[byear]', '$_POST[sex]', '$join')");

 

The "join" field type is set to DATE.

 

What am I doing wrong?

 

Thanks :)

If you were using mysql_error() to debug this, you would get a SQL syntax error at the join column name in the query statement.

 

join is a reserved keyword and should not be used as a column name. You either need to rename it or enclose it in back-ticks ` every place it gets used as a column name in a query.

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.