出力を取得するためにjson配列を使用して、同じ名前を持つdbからデータを取得する必要があります。
function search_review($input, $serviceName){
$data = array();
$ipJson = json_encode($input);
$this->db->select('*');
$this->db->from('reviews');
$this->db->where('reviewee_name', $input['reviewee_name']);
$query = $this->db->get();
$result = $query->result();
if (!empty($result)) {
foreach ($query->result() as $row)
{
$data[]['reviewer_id'] = $row->reviewer_id;
$data[]['reviewee_name'] = $row->reviewee_name;
$data[]['tournament_played_c_s'] = $row->tournament_played_c_s;
}
$data['message'] = 'Review details retrieved successfully.';
$status = $this->clamo_lib->return_status('success', $serviceName, $data, $ipJson);
} else {
$data['message'] = 'Unable to retrieve review details.';
$status = $this->clamo_lib->return_status('error', $serviceName, $data, $ipJson);
}
return $status;
}
0出力:
出力を次のように取得する必要があります
<data>
<_0/>
<message>Review details retrieved successfully.</message>
<reviewee_name>deepi</reviewee_name>
<reviewer_id>4</reviewer_id>
<tournament_played_c_s>karnataka,bangalore</tournament_played_c_s>
</data>
<data>
<_1/>
<message>Review details retrieved successfully.</message>
<reviewee_name>deepi</reviewee_name>
<reviewer_id>5</reviewer_id>
<tournament_played_c_s>kerala</tournament_played_c_s>
</data>
これで何を変更する必要がありますか?