-1
我正在嘗試array_combine將所有這些數組轉換爲具有唯一值的單個數組。在foreach循環中使用array_combine將多個數組轉換爲單個數組
$arr_ch_no = array();
$arr_ch_no[] = "'***0***'";
$sql = mysql_query("SELECT ship_name,voy_no from tb_veh_data_entry WHERE (ETAQ > '".date("Y-m-d")."' or (ETAQ <> '0000-00-00' and stock = 0 and stock_sale_date = '0000-00-00')) and (user_id = 'UI08-00000063' or user_id = 'UI09-00000111') and stock_country = 58 and ((buyer in ('6371','2509','2535') and arica = 0) or arica=4) group by ship_name,voy_no ");
while($row_no = mysql_fetch_array($sql))
{
$str_no_ch = selFieldCon("tb_veh_data_entry","GROUP_CONCAT(frame_no)"," ship_name = '".$row_no['ship_name']."' and voy_no = '".$row_no['voy_no']."' and (user_id = 'UI08-00000063' or user_id = 'UI09-00000111') and stock_country = 58 and ((buyer in ('6371','2509','2535') and arica = 0) or arica=4) and ETAQ <> '0000-00-00' ".$this->condition."");
$arr_no_ch = array();
$arr_no_ch = explode(",",$str_no_ch);
if($str_no_ch != '')
foreach($arr_no_ch as $val)
$arr_ch_no[] = "'".$val."'";
}
這個查詢使用了foreach循環
$sql = "SELECT * FROM tb_veh_data_entry WHERE 1 ".$this->condition." ";
我想這裏面的foreach。如何將其轉換爲foreach內的單個數組。
Array
(
[0] => '***0***'
[1] => 'NCP100-0027131'
)
Array
(
[0] => '***0***'
[1] => 'NCP100-0027131'
)
Array
(
[0] => '***0***'
[1] => 'NCP100-0027131'
)
但我沒有得到任何東西。
是你的實際代碼? – billynoah
請定義您將多個數組轉換爲一個數組的步驟,預期的結果是什麼? – user10089632
@billynoah更新。 –