我正在为我的
Android应用程序创建一个休息服务,其中外部数据库返回要存储在应用程序本地数据库中的项目.我有一切工作,除了blob被返回为空.
这是我的杰森回应的例子(图片和缩略图字段是blob)
{"id":"2","user_id":"1","name":"testing","type":"bouldering","picture":null,"lat":"36","long":"81","alt":"41932","accuracy":"53","thumbnail":null}
这是我的php脚本来返回数据.
require_once('config.php');
$mysqli = new mysqli(DB_HOST,DB_USER,DB_PASSWORD,DB_NAME);
$sql = 'select * from spot_main';
$results =$mysqli->query($sql);
$spots = array(); //array to parse jason from
while($spot = $results->fetch_assoc()){
$spots[] = $spot;
}
echo json_encode($spots);
?>
任何人知道这个问题的解决方案?我知道我不是最有效的方法(更好的存储在文件系统中的图像),但我需要这个工作.