Advertisement
AyaAbouzeid

Untitled

Jul 29th, 2016
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.98 KB | None | 0 0
  1. <!Doctype html>
  2. <html>
  3.  
  4. </html>
  5. <head>
  6. <title>Hello</title>
  7.  
  8. </head>
  9. <body>
  10.  
  11. Connection to DB
  12.  
  13. <?php
  14.  
  15. $serverName = 'localhost';
  16. $userName ='root';
  17. $password = '';
  18. $databaseName = 'session-3';
  19.  
  20. $connection = new mysqli($serverName, $userName , $password , $databaseName);
  21.  
  22. if($connection->connect_error){
  23.     die ("connection failed: " . $connection->connect_error);
  24. }
  25.  
  26. echo "success <br/>";
  27. $emaill = $_POST['email'] ;
  28.  
  29. $sql ="Select * From users Where Email = '$emaill' ";
  30. $result  = $connection ->query($sql);
  31.  
  32. if($result->num_rows > 0){
  33.  
  34.     while($row = $result->fetch_assoc()){
  35.  
  36.         echo "ID: ".$row["ID"]. "-Email: ".$row["Email"] . "-Password : ".$row["Password"] . "<br/>";
  37.     }
  38.  
  39.     }
  40.     else{
  41. echo " 0 results" ;
  42.  
  43.     }
  44.  
  45.     $connection -> close();
  46.  
  47. ?>
  48.  
  49.  
  50. <form method="POST" action="welcome.php">
  51. Email: <input type="text" name="email">
  52. <!-- Password: <input type="password" name="password">
  53.  -->
  54. <input type="submit" name="Login">
  55.  
  56.  
  57. </form>
  58.  
  59. </body>
  60.  
  61. <html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement