Skip to content

Instantly share code, notes, and snippets.

@hoxsec
Created June 5, 2018 10:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hoxsec/fdb739c7b6a9707a32971928a6f9e909 to your computer and use it in GitHub Desktop.
Save hoxsec/fdb739c7b6a9707a32971928a6f9e909 to your computer and use it in GitHub Desktop.
<?php
require_once 'DB_FILE_HERE';
// SQL statement
$sql = mysqli_query($conn, "QUERY_HERE");
// Define array for row
$rows = array();
// Set each row into array.
while ($row = $sql->fetch_assoc()) {
$rows[] = $row;
}
// Echo JSON array
print json_encode($rows);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment