Q:

Unable to retrieve output data from database

I am using the following PHP code to retrieve the shop information fields from the database but Im getting the error shown below when I run the PHP.
<?php
include ('database.php');

$locLat ;
$locLng ;
$shopName;
$shopContact;

$sql = "SELECT s_iD, s_name,s_contNo,s_lat,s_long from tbl_shop";

$result = mysqli_query($con,$sql);
$arrayResult = array();

while ($row = mysqli_fetch_array($result)){
    array_push($arrayResult,array("id"=>$row['s_iD'],"shopName"=>$row['s_name'],"shopContact"=>$row['s_contNo'],"latitude"=>$row['s_lat'],
        "longitude"=>$row['s_long']));
}

echo json_encode (array('result'=> $result));

mysqli_close($con);

But the output is always :

{"result":{"current_field":null,"field_count":null,"lengths":null,"num_rows":null,"type":null}}

A:

here is your updated code should be :
<?php
include ('database.php');

$locLat ;
$locLng ;
$shopName;
$shopContact;

$sql = "SELECT s_iD, s_name,s_contNo,s_lat,s_long from tbl_shop";

$result = mysqli_query($con,$sql);
$arrayResult = array();

while ($row = mysqli_fetch_array($result)){
    array_push($arrayResult,array("id"=>$row['s_iD'],"shopName"=>$row['s_name'],"shopContact"=>$row['s_contNo'],"latitude"=>$row['s_lat'],
        "longitude"=>$row['s_long']));
}

echo json_encode (array('result'=> $arrayResult));  // <-- changed from $result

mysqli_close($con);

