I am having an issue with updating records from an array. When I go to update I am only getting the first digit. For example if the real value is 58 I am only getting the 5 inserted
Below is my code with further explanation below:
$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);
}
What is happening is when I uncomment the first print_r I get:
EPArray
(
[0] => 16
[1] => 51067d38
which is right. But if I comment it out and uncomment the second one I get:
51067d38
(
[sold_ep_c] => 1
)
Why is this stripping the first digit?
As per chat…your arrays aren’t initialized.
$bidArr[$key] = array();in the first loop!