-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcustomStep.php
More file actions
34 lines (25 loc) · 862 Bytes
/
customStep.php
File metadata and controls
34 lines (25 loc) · 862 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
require "connect.php";
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$clientuserID = $_POST['clientID'];
$from=$_POST['from'];
$to=$_POST['to'];
$from = date('Y-m-d', strtotime($from));
$to = date('Y-m-d', strtotime($to));
//$clientuserID = "dev";
//$from='2023-07-07';
//$to='2023-07-26';
$sql = "select steps,dateandtime FROM steptracker WHERE clientuserID = '$clientuserID' AND dateandtime between '$from' AND '$to';";
$result = mysqli_query($conn, $sql); //or die("Error in Selecting " . mysqli_error($connection));
$emparray = array();
$full = array();
while($row =mysqli_fetch_assoc($result))
{
$emparray['steps'] = $row['steps'];
$emparray['date'] = date("d",strtotime($row['dateandtime']));
$full[] = $emparray;
}
echo json_encode(['steps' => $full]);
?>