不在数据库中输入值[关闭]

mysql_query("insert into user_info(Name,Id,Password,Email,Gender,Date_of_birth) values('".$name."','".$iden."','".$pass1."','".$email."','".$gender."','STR_TO_DATE('$date','%d,%m,%Y')')");

Can anyone tell which part of this code is incorrect, as it is not entering anything in the database.....

Unquote the 'STR_TO_DATE('$date','%d,%m,%Y')' call. I also cleaned up the rest of the code a bit. As a result you get:

mysql_query("insert into user_info(Name,Id,Password,Email,Gender,Date_of_birth) values('$name','$iden','$pass1','$email','$gender',STR_TO_DATE('$date','%d,%m,%Y'))");

On this part:

'STR_TO_DATE('$date','%d,%m,%Y')'

There are single quotes inside single quotes, causing an error. To fix this, replace the single quotes on the arguments to escaped double quotes, like this:

'STR_TO_DATE(\"$date\",\"%d,%m,%Y\")'

However, since you probably want to use the function and not post it literally, you should just remove the outside quotes, like this:

STR_TO_DATE('$date','%d,%m,%Y')