Вопрос

When executing the following code, no Errors occur but the data isn't put into the database!

$zero = 0;
    $connection = new mysqli("localhost", "andrewle_me", "*****", "andrewle_velocity");
    $stmt = $connection->prepare("INSERT INTO accounts Values(?, ?, ?, ?, ?, ?, ?, ?)");
    $stmt->bind_param("issssssi", $zero, $_POST["username"], password_hash($_POST["password"], PASSWORD_DEFAULT), $_POST["Email"], $_POST["firstname"], $_POST["lastname"], $_POST["nationality"], $zero);
    $stmt->execute();
    $stmt->close();
    $connection->close();
    echo "Success";
Это было полезно?

Решение

Define your posts and password hash outside of the param binding. Set the fields in the table that your values are going to be entered into.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top