Here is my code php
that what it does is show in JSON
the information of the table.
if($_SERVER["REQUEST_METHOD"]=="POST"){
include('conexion.php');
$result = mysqli_query($con,"SELECT * FROM localidades").mysqli_error($con); //<<<<<<Aqui marca el fallo!
while ($row = $result->fetch_assoc()) {
$arr[] = $row;
}
$json = json_encode($arr);
echo $json;
}
ERROR
Object of class mysqli_result could not be converted to string