Skip to content

Commit

Permalink
Add locations read api endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
wrongecho committed Feb 24, 2024
1 parent da54b12 commit 54e015b
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions api/v1/locations/read.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

require_once '../validate_api_key.php';

require_once '../require_get_method.php';


if (isset($_GET['location_id'])) {
// Location via ID (single)

$id = intval($_GET['location_id']);
$sql = mysqli_query($mysqli, "SELECT * FROM locations WHERE location_id = '$id' AND location_client_id LIKE '$client_id'");

} else {
// All locations

$sql = mysqli_query($mysqli, "SELECT * FROM locations WHERE location_client_id LIKE '$client_id' ORDER BY location_id LIMIT $limit OFFSET $offset");
}

// Output
require_once "../read_output.php";

0 comments on commit 54e015b

Please sign in to comment.