2013-09-22 163 views
0

我有一個array(1) { [0]=> array(1) { ["id"]=> string(1) "2" } }陣列字符串

怎麼能打破它爲一個字符串,因爲我只得到一個價值?

型號:

$table = $this->_table_products_manufacturers; 
     $query = $this->db->query("SELECT $table.id FROM $table WHERE $table.id = $manufacturer_id"); 

     return $query->result_array(); 

回答

1

喜歡的東西:

$table = $this->_table_products_manufacturers; 
$query = $this->db->query("SELECT $table.id FROM $table WHERE $table.id = $manufacturer_id"); 
$result = $query->result_array(); 
return $result[0]['id']; 

是否有助於?

+0

謝謝你沒有想到它那樣 –

+0

如果這回復您的查詢,請接受此爲「答案」。謝謝 :) – anupam