Skip to content

Commit

Permalink
Ordering by id, desc
Browse files Browse the repository at this point in the history
  • Loading branch information
mrinaldhar committed Dec 10, 2015
1 parent fdd70f9 commit 036f6d8
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions utils/getAllTrips.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php
session_start();
require_once("ldap.php");
require_once("userhelper.php");

function getAllTrips() {
if(!isLoggedIn()) {
$response = array(
"status" => 1,
"error" => "Invalid session" );
echo json_encode($response);
return;
}

include "config.php";
$query = "SELECT * FROM " . $db_mysql_table_name . " WHERE userid='" . getUid() . "' ORDER BY id DESC";

$success = mysqli_query($link, $query);
if($success) {
$rows = array();
while ($row = mysqli_fetch_assoc($success))
$rows[] = $row;
$response = array(
"status" => 0,
"data" => $rows
);
echo json_encode($response);
}
else {
$response = array(
"status" => 1,
"error" => "Unable to run select in DB" );
echo json_encode($response);
}
}

getAllTrips();
?>

0 comments on commit 036f6d8

Please sign in to comment.