我有一个如下所示的输出,如何将结果循环到数组中?
16
PT. QWERT
62218501053
JL. MAYJEN SUTOYO
16
PT. ABCD
62218501053
JL. MAYJEN SUTOYO
怎么换成这个?
Array
(
[id_cs] => 16
[nama] => PT. QWERT
[tlp] => 87878
[alamat_detail] => JL. MAYJEN SUTOYO
)
1
Array
(
[id_cs] => 16
[nama] => PT. ABCD
[tlp] => 123
[alamat_detail] => JL. MAYJEN SUTOYO
)
1
这是我的代码
$array = array(
'id_cs' => $row['AN'],
'nama' => $row['AO'],
'tlp' => $row['AP'],
'alamat_detail' => $row['AQ'],
);
foreach($array as $key => $value) {
if (empty($value))
unset($array[$key]);
}
foreach($array as $key => $value) {
echo($array[$key]."<br>");
}
//$this->db->insert('customer_address',$array);
如何实现代码?谢谢你的回答
编写此代码。
$array[] = array(
'id_cs' => $row['AN'],
'nama' => $row['AO'],
'tlp' => $row['AP'],
'alamat_detail' => $row['AQ'] );
foreach($array as $key => $value) {
if (empty($value))
unset($array[$key]); }
foreach($array as $row){
$this->db->insert('customer_address',$row); }