How to Convert mysql all tables to json(How to Select Multiple tables, not one);
I am trying to select multiple table of my db: then convert it from mysql to json format Please guide me!
<body>
<?php
$connect = mysqli_connect("localhost", "root", "", "martlink_db");
$sql = "SELECT * FROM users";
$result = mysqli_query($connect, $sql);
$json_array = array();
while($row = mysqli_fetch_assoc($result))
{
$json_array[] = $row;
}
echo '<pre>';
print_r(json_encode($json_array));
echo '</pre>';
//echo json_encode($json_array);
?>
</body>