Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- connection.php
- <?php
- $db_name = "aplikacja treningowa";
- $mysql_username = "root";
- $mysql_password = "";
- $server_name = "localhost";
- $connection = mysqli_connect($server_name, $mysql_username, $mysql_password, $db_name);
- ?>
- get_all.php
- <?php
- require "connection.php";
- $response = array();
- $mysql_query = "SELECT *FROM map_data";
- $result = mysqli_query($connection, $mysql_query);
- if(mysqli_num_rows($result) > 0) {
- $response["map_data"] = array();
- while($row = mysqli_fetch_array($result)) {
- $stat = array();
- $stat["id"] = $row[0];
- $stat["mode"] = $row[1];
- $stat["distance"] = $row[2];
- $stat["calories"] = $row[3];
- array_push($response["map_data"], $stat);
- }
- $response["success"] = 1;
- }
- $connection->close();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement