Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Prepare variables for database connection
- $dbusername = "ajoy"; // enter database username, I used "arduino" in step 2.2
- $dbpassword = ""; // enter database password, I used "arduinotest" in step 2.2
- $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"
- $db = "dsd";
- // Connect to your database
- $connection= mysqli_connect("do.ajoydas.com:3306/",$dbusername ,$dbpassword ,$db );
- // Prepare the SQL statement
- $lat= $_GET["lat"];
- $lang= $_GET["lang"];
- // $lat= 24.5;
- // $lang= 90.52;
- $query = "INSERT INTO location (lat, lang) VALUES ('".$lat."','".$lang."')";
- echo $query;
- // Execute SQL statement
- $result = mysqli_query($connection, $query) ;
- if($result){
- echo "\nSuccess";
- }else{
- echo "\nFailed";
- }
- mysqli_close($connection);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement