W.Kurek W.Kurek - 3 months ago 5x
PHP Question

How to insert date to MySQL from html input?

I've problem with inserting a date

enter code here
into a MySQL database. On my webpage i've got a input which type is 'date' but there is a problem with inserting value of this input into database properly.

$connection->query("INSERT INTO users VALUES(NULL, '$nick', '$password_hash', '$email',".$_POST['gender'].",".$_POST['bday'].")")

Have you got any solution for my problem?


Use this code. you forget Single quote (').

$connection->query("INSERT INTO users VALUES(NULL, '$nick', '$password_hash', '$email','".$_POST['gender']."','".$_POST['bday']."')")