Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2016
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.68 KB | None | 0 0
  1. <?php
  2.  
  3. $servername = "localhost";
  4. $username = "username";
  5. $password = "password";
  6. $dbname = "database name";
  7.  
  8. // Create connection
  9. $conn = new mysqli($servername, $username, $password, $dbname);
  10.  
  11. // Check connection
  12. if (!$conn) {
  13.     die("Connection failed: " . mysqli_connect_error());
  14. }
  15. echo "Connected successfully";
  16.  
  17. $sq = "SELECT * FROM members WHERE email= '".$email."'";
  18. $result = $conn->query($sq);
  19.  
  20. if ($result->num_rows > 0) {
  21.     // output data of each row
  22.     while($row = $result->fetch_assoc()) {
  23.         echo "id: " . $row["id"]. " - Email: " . $row["email"]. "<br />";
  24.     }
  25. } else {
  26.     echo "0 results";
  27. }
  28.  
  29. //close connection
  30. $conn->close();
  31.  
  32.  
  33. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement