Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. //Opening Database Connection.
  2. $cxn = mysqli_connect($hostname,$username,$password,$database) or die ("Couldn't connect to GC server.");
  3.  
  4.  
  5. //CHECKING FOR EXISTING KEY
  6.  
  7. //Check to see if a POST request has been submitted.
  8. if(!empty($_POST)) {
  9. //A POST request was submitted, so define the variables.
  10. $VER = $_POST['version'];
  11.  
  12. //Create the query and send it to the database.
  13. $sql = "SELECT * FROM Development WHERE ID = '".$VER."'";
  14. $result = mysqli_query($cxn, $sql);
  15.  
  16. //If the database finds at least one row...
  17. if(mysqli_num_rows($result) > 0) {
  18. //Set the associative array.
  19. $data = mysqli_fetch_assoc($result);
  20. echo $data['Version'];
  21. //If the version is not found.
  22. } else {
  23. echo "Wrong Version!";
  24. }
  25. } else {
  26. //A POST request was not submitted, so display an error.
  27. echo "Sorry! You're not allowed to view this page.";
  28. }
  29. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement