Advertisement
Guest User

Untitled

a guest
Apr 30th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. <?php
  2. // Prepare variables for database connection
  3. $dbusername = "ajoy"; // enter database username, I used "arduino" in step 2.2
  4. $dbpassword = ""; // enter database password, I used "arduinotest" in step 2.2
  5. $server = "do.ajoydas.com"; // IMPORTANT: if you are using XAMPP enter "localhost", but if you have an online website enter its address, ie."www.yourwebsite.com"
  6. $db = "dsd";
  7. // Connect to your database
  8. $connection= mysqli_connect("do.ajoydas.com:3306/",$dbusername ,$dbpassword ,$db );
  9. // Prepare the SQL statement
  10.  
  11. $lat= $_GET["lat"];
  12. $lang= $_GET["lang"];
  13.  
  14. // $lat= 24.5;
  15. // $lang= 90.52;
  16.  
  17. $query = "INSERT INTO location (lat, lang) VALUES ('".$lat."','".$lang."')";
  18. echo $query;
  19. // Execute SQL statement
  20. $result = mysqli_query($connection, $query) ;
  21.  
  22. if($result){
  23. echo "\nSuccess";
  24. }else{
  25. echo "\nFailed";
  26. }
  27.  
  28. mysqli_close($connection);
  29. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement