1

I am trying to insert something into my table called user. I have checked the names of the columns and it is correct, but it doesn't seem to go through the prepared statement as none of my echo messages shows up. I am using a password hash, but have made sure the varchar is "big" enough. It worked on the localhost, but not when I uploaded it to a server.

$password = password_hash($_POST['password'], PASSWORD_DEFAULT);

if($stmt = $conn -> prepare("INSERT INTO user (firstname, lastname, username, password, mail, joined) VALUES (?,?,?,?,?, NOW())")){
    echo "hello banana";
    $stmt -> bind_param("sssss",$_POST["firstname"], $_POST["lastname"], $_POST["username"], $password, $_POST["email"]);
    $stmt -> execute();
    echo "hello fruit";
    $id = $stmt -> insert_id;
    $stmt -> store_result();
    $_SESSION["id"] = $id;
    $redirectIndex = 1;
    $message =  "Account registered. You can now go to the <a href=\"index.php\"> front page</a>.";
     
    
    $stmt -> close(); 
}
Barmar
  • 741,623
  • 53
  • 500
  • 612
Meek
  • 87
  • 11

0 Answers0