A
A
Alexey Sklyarov2018-02-05 22:25:11
PHP
Alexey Sklyarov, 2018-02-05 22:25:11

Why is the user not created in the database when the request is successfully executed?

There is a piece of code (cut out of context):

$member_group = 'user';
      $password = hash('sha256', $password);
      $sql = 'INSERT INTO users (login,email,password,invite,member_group) VALUES(?,?,?,?,?)';
      if($stmts = $this->db->prepare($sql)) {
          $stmts->bind_param("sssss", $login, $email, $password,$invite,$member_group);
          $stmts->execute();
      } else {
          $this->error = $this->db->errno . ' ' . $this->db->error;
      }
      $user_id = $stmts->insert_id; // Получаем ID созданного пользователя
      $stmts->close();

This piece of code works properly (I ran more than one test), put a check on the execution of the request - no errors. But the user himself is not entered into the database, and after this piece there is a similar piece of code for UPDATE, it is properly executed. What problems can there be, where can I look?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lazy @BojackHorseman PHP, 2018-02-05
Tag

binding curve parameters? Is PDO::ERRMODE_SILENT worth it? $stmts->execute() returns false?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question