Reference link:
1 https://stackoverflow.com/questions/40650747/uncaught-error-call-to-undefined-function-mysql-select-db
The solutions are as follows:
<?php
$username="root";
$password="namungoona";
$hostname = "localhost";
//connection string with database
$dbhandle = mysqli_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
echo "";
// connect with database
$selected = mysqli_select_db($dbhandle, "police")
or die("Could not select examples");
//query fire
$result = mysqli_query($dbhandle,"select * from News;");
$json_response = array();
// fetch data in array format
while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
// Fetch data of Fname Column and store in array of row_array
$row_array['Headlines'] = $row['Headlines'];
$row_array['Details'] = $row['Details'];
$row_array['NewsPhoto'] = $row['NewsPhoto'];
//push the values in the array
array_push($json_response,$row_array);
}
//
echo json_encode($json_response);
mysqli_free_result($result);
?>