Skip to content

Instantly share code, notes, and snippets.

@itswadesh
Last active March 27, 2017 17:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itswadesh/06bf89bc09c3e9ced3a928c27d9ffc60 to your computer and use it in GitHub Desktop.
Save itswadesh/06bf89bc09c3e9ced3a928c27d9ffc60 to your computer and use it in GitHub Desktop.
<?php
require_once '../includes/db.php'; // The mysql database connection script
$status = '%';
if(isset($_GET['status'])){
$status = $_GET['status'];
}
$query="select ID, TASK, STATUS from tasks where status like '$status' order by status,id desc";
$result = $mysqli->query($query) or die($mysqli->error.__LINE__);
$arr = array();
if($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$arr[] = $row;
}
}
# JSON-encode the response
echo $json_response = json_encode($arr);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment