You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
877 B

<?php
$servername = "localhost";
$username = "root";
$password = "root";
$dbname = "tracking_2d";
$tableName = "records";
$response = array();
if (!empty($_POST)) {
$testName = $_POST["name"];
if(!empty($testName)){
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT * FROM " .$tableName. " WHERE test_name = '".$testName."'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
array_push($response, $row["data"]);
}
}
$conn->close();
}
}
header('Content-type:application/json;charset=utf-8');
echo json_encode($response);