I want to fetch an imgs from mysql records . i've read how to send it to android i realized that it must to encode it to base64 then decode it in android so i just want to know how to fetch the img from the table and decode it ? i don't want to use url() and send it ! i just want to send decode string to android ??
heres my php code
**<?php
$response = array();
require_once __DIR__ . '/db_connect.php';
$obj = new DB_CONNECT();
$con=$obj->connect();
$result =mysqli_query($con,"SELECT * FROM doctors ");
if (!empty($result)) {
if (mysqli_num_rows($result) > 0) {
$result = mysqli_fetch_array($result);
$product = array();
$product["d_id"] = $result["d_id"];
$product["name"] = $result["name"];
$product["major"] = $result["major"];
$product["clinic"] = $result["clinic"];
$product["img"] = $result["img"];
$response["success"] = 1;
$response["product"] = array();
array_push($response["product"], $product);
echo json_encode($response);
} else {
$response["success"] = 0;
$response["message"] = "No data found";
echo json_encode($response);
}
} else {
$response["success"] = 0;
$response["message"] = "No data found";
echo json_encode($response);
}
?>**
Aucun commentaire:
Enregistrer un commentaire