Last active
March 9, 2018 09:27
-
-
Save arif98741/b92f011b17010e02f4b011db221da105 to your computer and use it in GitHub Desktop.
Get Data From Server as Json Response
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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