Please help me. I don't actually use PHP but I need to use in my Login/Register project.
$con = mysqli_connect("***", "***", "***", "***");
$name = $_POST["name"];
$username = $_POST["username"];
$password = $_POST["password"];
$statement = mysqli_prepare($con, "INSERT INTO user (name, username, password) VALUES (?, ?, ?)");
mysqli_stmt_bind_param($statement, "siss", $name, $username, $password);
mysqli_stmt_execute($statement);
$response = array();
$response["success"] = true;
echo json_encode($response);
But it says
Warning: mysqli_stmt_bind_param() [function.mysqli-stmt-bind-param]: Number of elements in type definition string doesn't match number of bind variables in /home/a3598479/public_html/Register.php on line 8
How can I fix this?
I think problem in following statement:
You are passing
siss
which means it there should be 4params
with typesstring
,integer
,string
andstring
which is wrong as you have onlythree parameters
which are all string.So the statement should be like this: