Guest User

Untitled

a guest
Dec 3rd, 2017
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. <?php
  2.  
  3. $connect= new mysqli('localhost', 'root','' ,'prueba2');
  4.  
  5. if($connect->connect_error){
  6. die('connection failed');
  7. }else {
  8. echo 'connection worked';
  9. }
  10.  
  11. $username= $_POST['username'];
  12. $password= $_POST['password'];
  13.  
  14. $sql="SELECT name FROM users WHERE username='$username' AND
  15. password='$password'";
  16.  
  17. $result= $connect->query($sql);
  18.  
  19. if($result-> num_rows> 0){
  20. while($row=$result->fetch_assoc()){
  21. echo "<br>Admin name is: " . $row["name"];
  22. }
  23. } else {
  24. echo "<br>Username and password dont match";
  25. }
  26.  
  27. ?>
Add Comment
Please, Sign In to add comment