Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $connection = Database::getInstance()->OpenConnection();
- $sql = "select * from user where user_name = ? and password = ?;";
- $statement = $connection->prepare($sql);
- //if any error happen in connection
- if (!$statement) {
- echo 'erro na consulta: '. $connection->errno .' - '. $connection->error;
- }
- //associate the user name and password with sql parameters,
- //execute the query and store the result
- $statement->bind_param('ss', $user,$password);
- $statement->execute();
- $result = $statement->get_result();
- $user;
- //create and set the user variable
- while($row = mysqli_fetch_array($result)){
- $user = new User($row["idUser"], $row["name"], $row["email"], $row["user_name"], $row["password"], $row["type"], $row["active"], $row["idAdministrator"]);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement