<?php
//include "include/DB_Connect.php";
$con = new mysqli("localhost", "user", "test", "testdb");
mysqli_set_charset($con, "utf8");
# check connection
if ($con->connect_errno) {
echo json_encode("MySQL error no ");
exit();
}
$query = "SELECT * FROM mytab";
$sql = mysqli_query($con, $query);
$json_response = array();
while ($row = mysqli_fetch_array($sql)) {
$row_array['id'] = $row['b_id'];
$row_array['name'] = $row['name'];
$row_array['url'] = $row['path'];
array_push($json_response, $row_array);
}
echo json_encode($json_response);
// now show the json tring
?>