これを試してください:
<?php
//Connect to the database
$databasehost = "YOUR DATABASE HOST";
$databasename = "YOUR DATABASE NAME";
$databaseusername ="YOUR DATABASE USERNAME";
$databasepassword = "YOUR DATABASE PASSWORD";
$con = mysqli_connect($databasehost, $databaseusername, $databasepassword, $databasename) or die(mysqli_error($con));
mysqli_set_charset ($con, "utf8");
$sql = "SELECT image, titulo, tecnica, medidas FROM upload;";
$res = mysqli_query($con, $sql);
$result = array();
while($row = mysqli_fetch_array($res)) {
array_push($result,
array(
'image'=>base64_encode($row[0]),
'titulo'=>$row[1],
'tecnica'=>$row[2],
'medidas'=>$row[3]
));
}
echo json_encode(array($result));
mysqli_close($con);
これにより、データは次のように出力されます:
それが役に立てば幸い!幸運を!ハッピーコーディング!