Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $i=0;
- do {
- $result = $this->mysqli->query("SELECT * FROM `lock` WHERE `table_name`='USER'");
- $numRows = $result->num_rows;
- if ($numRows > 0) {
- echo "Waiting for table (USER) count: " . $i + 1 ;
- sleep(0.05);
- $i++;
- }
- } while ($numRows > 0 && $i < 9);
- if ($i == 9) {
- echo "Previous lock (USER) timeout";
- $this->mysqli->query("DELETE `lock` WHERE `table_name`='USER' ");
- echo "Previous lock destroyed (USER)";
- }
- $this->mysqli->query("INSERT INTO `lock`(`table_name`) VALUES ('USER')");
- echo "Lock taken (USER)";
- $stmt_user->bind_param("ssssss", $this->name, $this->contactNumber, $this->email, $this->password, $this->salt, $this->gender) or trigger_error(mysql_error());
- $stmt_get_user_id->bind_result($USER_id) or trigger_error(mysql_error());
- $stmt_user->execute() or trigger_error(mysql_error());
- $stmt_get_user_id->execute() or trigger_error(mysql_error());
- $stmt_get_user_id->store_result() or trigger_error(mysql_error());
- $stmt_get_user_id->fetch() or trigger_error(mysql_error());
- $this->mysqli->query("DELETE `lock` WHERE `table_name`='USER' ");
- echo "Lock given up (USER)";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement