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 :)

Link to comment
Share on other sites

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.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.