views:

77

answers:

1

Hello all i have this script and i will not insert into the database and i get no errors :S, do you know what it is?

    function createUser($username, $password) {
    $mysql = connect();
    if($stmt = $mysql->prepare('INSERT INTO users (username, password, alder, hood, fornavn, efternavn, city, ip, level, email) VALUES (?,?,?,?,?,?,?,?,?,?)'))  {
      $stmt->bind_param('ssssssssss',$username,$password, $alder, $hood, $fornavn, $efternavn, $city, $ip, $level, $email);
      $stmt->execute();
      $stmt->close();
    } else {
      echo 'error: ' . $mysql->error;
    }
A: 

Maybe you get an error from the $stmt->execute(); call? Check $stmt->error (which is a string) just before you run $stmt->close();

Maybe some of your values should not be strings, such as the level and/or hood parameters? They look like typical integer parameters.

Emil Vikström