這是我的模塊訪問陣列變量
function order_alert($email){
$this->db->select("tbl_customer_registration.cus_mobile");
$this->db->from('tbl_customer_registration');
$this->db->where('tbl_customer_registration.cus_email', $email);
$query = $this->db->get();
echo '<pre>';
print_r($query->result()) ;
}
它上面的代碼
Array
(
[0] => stdClass Object
(
[cus_mobile] => 0716352642
)
)
返回以下結果在位指示我使用的foreach
foreach($result as $row) :
echo $row['cus_mobile'];
得到[cus_mobile]
出於上述陣列,但它給我所有0123在tbl_customer_registration
中有行。
如何從中獲得唯一的[cus_mobile] => 0716352642
。
感謝我試過的情況下,那但是相同的結果。在foreach裏面有 – user3766509
嗎? – Gil