我在codeigniter中執行我的項目。我的問題是我會爲'game_aspect_details'
JSON格式一樣json在codeigniter中對數組進行編碼和解碼
"{"game_aspect_details":[{"aspect_id":"1"},{"aspect_id":"4"}]}"
存儲值這個選擇查詢,我將解碼JSON格式和檢查的foreach該值。
$this->db->select('game_aspect_details');
$this->db->from('share_reviews');
$this->db->where('review_id',6);
$query = $this->db->get();
$result = $query->result();
$test = $result[0]->game_aspect_details;
$res = json_decode($test);
$result_array = array();
foreach ($res as $row)
{
$this->db->select('comments');
$this->db->from('review_ratings');
$this->db->where('game_aspect_id',$row->game_aspect_details); //here i need
$query1 = $this->db->get(); to check 1 and 4
$resultReviews['comments'] = $query1->result();
$result_array[] = $resultReviews;
}
print_r($res);
exit;
你有什麼問題嗎? – 2013-07-29 11:05:49
我需要解碼該json格式,我必須得到值1和4 – sangee