Skip to content

Instantly share code, notes, and snippets.

@arif98741
Last active March 9, 2018 09:03
Show Gist options
  • Save arif98741/b38323d9651fe6b1c50b0e143320a0a2 to your computer and use it in GitHub Desktop.
Save arif98741/b38323d9651fe6b1c50b0e143320a0a2 to your computer and use it in GitHub Desktop.
JSON Data Retrive
<?php
$con = new mysqli("localhost","root","","database");
$result = array();
if($con)
{
$stmt = $con->query("select * from android_data");
//$stmt = $con->query("select * from tbl_invoice_products");
if($stmt)
{
while($row = $stmt->fetch_assoc())
{
$result[] = $row;
}
echo json_encode($result);
}
}else{
$result['error'] = "Connection Failed";
echo json_encode($result);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment