得到空响应,如果有blob字段[PHP]

时间:2015-07-02 06:17:09

标签: php mysql mysqli

我要通过php从myqli db中检索数据。

$query = "SELECT id, parentId, firstName, middleName, lastName, mobileNumber, photo FROM person WHERE orgId='".$orgId."' ";

$sql = mysqli_query($con, $query);
$data=array();
        if($rows_count!=0){
            while ($rows_fetch = mysqli_fetch_assoc($sql))
            {
                var_dump($rows_fetch);
                $info = $rows_fetch;    
                array_push($data, $info);
                $isSuccessful = true;
                $code = 200;
            }
        }else{
            $isSuccessful = true;
            $code = 202;
        }

        $response = array("resp"=>$data, "code"=>$code, "isSuccessful"=>$isSuccessful);

如果blob字段为空,我会收到回复。如果blob在那里,我得到空的回应

1 个答案:

答案 0 :(得分:1)

while ($rows_fetch = mysqli_fetch_assoc($sql))
            {
                //var_dump($rows_fetch);
                $info = $rows_fetch;    
                $info['photo'] = base64_encode($rows_fetch['photo']);
                array_push($data, $info);
                $isSuccessful = true;
                $code = 200;
            }

我已将blob更改为base64代码。