+ 1
How to insert data to my database
I have created a user registration page, but I am not able to save the username and password to my database, it should be like when you enter the username and password & click submit then it must be save in my database, but I am not getting the right code. Please help me.
2 Respuestas
+ 1
the form should go to a php page
On that page:
$mysql = new mysqli(host, username, password, db);
$insert = "INSERT INTO `users` SET `username` = '".$_POST['username']."', `password` = '".$_POST['password']."'";
$mysql->query($insert);
$id = $mysql->insert_id; // if you need it
change field names etc as you need to.