Skip to content

Instantly share code, notes, and snippets.

@arif98741
Last active March 9, 2018 09:27
Show Gist options
  • Save arif98741/b92f011b17010e02f4b011db221da105 to your computer and use it in GitHub Desktop.
Save arif98741/b92f011b17010e02f4b011db221da105 to your computer and use it in GitHub Desktop.
Get Data From Server as Json Response
<?php
require "conn.php";
if(isset($_POST["username"])) //always use isset function to skip unwanted request and error
{
$query = mysqli_query($conn, "select * from android_data where username='$user_name'");
if ($query) {
while ($row = mysqli_fetch_array($query)) {
$flag[] = $row;
}
echo(json_encode($flag));
}
$conn->close();
}
//you can also use mysqli_fetch_assoc() for getting data as associative array skip serial
//always stay in touch, stay with code.
//regards phpdark.com
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment