Advertisement
Guest User

Untitled

a guest
Jun 14th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. <?php
  2. $servername = "localhost";
  3. $server_username = "root";
  4. $server_password = "";
  5. $dbName = "test";
  6.  
  7. //$username = $_POST["usernamePost"];
  8.  
  9.  
  10. //Make Connection
  11. $conn = new mysqli($servername, $server_username,$server_password,$dbName);
  12. //Check Connection
  13.  
  14. if(!$conn)
  15. {
  16. die("Connection Failed.". mysql_connect_error());
  17. }
  18. $sql = "SELECT characterName WHERE username = ' 'Bob'";
  19. $result = mysqli_query($conn,$sql);
  20.  
  21. if(!$result)
  22. {
  23. echo "Failed to grab data";
  24. }
  25.  
  26. if(mysqli_num_rows($result) > 0)
  27. {
  28. echo $result;
  29. while($row = mysqli_fetch_assoc($result))
  30. {
  31. echo "characterName:".$row['characterName'].";";
  32. }
  33. }
  34.  
  35. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement