0
我在更新數組中的記錄時遇到問題。當我去更新時,我只獲得第一位數字。例如,如果實際值是58,我只得到了5插入的數組更新記錄
下面是我用下面進一步解釋代碼:
$bidArr = $tmpArr;
foreach($tmpArr as $key => $val)
{
$sqlEp = "select sum(endpoints_c), account_id1_c as id from accounts_cstm as ac join accounts as a on a.id = ac.id_c
where account_id1_c ='$val' and (status_c IN ('active','llp')) and deleted='0'";
$rowEp = $db->query($sqlEp);
$recordEp = $db->fetch_row($rowEp);
$bidArr[$key]['sold_ep_c'] = $recordEp[0];
//print "<pre>EP";
//print_r($recordEp);
}
foreach($bidArr as $key => $val)
{
$data['sold_ep_c'] = $val['sold_ep_c'];
$db->query_update(TABLE_ACC, $data, "id_c='".$key."'");
print "<pre>EP";
print_r($key);
print_r($data);
}
正在發生的事情是,當我去掉第一的print_r我得到:
EPArray ( [0] => 16 [1] => 51067d38
這是對的,但如果我評論出來,並取消對第二個我得到:。
51067d38 ( [sold_ep_c] => 1 )
爲什麼此汽提所述第一數字?
同樣的事情..仍然只是獲得第一個數字。 – ipengineer
當我這樣做,我得到一些隨機ID,而不是總: EP4406840a ( [sold_ep_c] => 406840a-ca39 ) – ipengineer
你能的print_r($ VAL [ 'sold_ep_c']); ? [在循環中] – Lusitanian