while()循环数组合并()访问这些值之外,而()的数组形式$行[“FIELD_NAME”]

这同时分析我的查询。 在$合并变种中包含的确切结构,我需要。

我所试图做的是采取合并$数据和过程它作为一个数组,并得到每个值在$行[0],$行[1],$行[3]等... while循环的外。

while ($row = mysql_fetch_row($query)) { $industries = explode(",", $row[13]); unset($row[13]); $merge = array_merge($row, $industries); }

的$例合并输出:

Array ( [0] => 3122 [1] => Painting Services [2] => [3] => 1234567 Tew Street [4] => [5] => Andover [6] => MA [7] => [8] => 01801 [9] => 000-555-1212 [10] => 000-555-1212 [11] => [12] => www.not-a-real-site.ooo [13] => Roofing ) Array ( [0] => 3123 [1] => Hobow Corporation [2] => [3] => 115 Sound Plaza, 117th Floor [4] => [5] => Woodbridge [6] => NJ [7] => [8] => 07111 [9] => 000-555-1212 [10] => 000-555-1212 [11] => [12] => www.not-a-real-site.ooo [13] => Energy )

--------------解决方案-------------

$rows = array();
while ($row = mysql_fetch_row($query)) {
$industries = explode(",", $row[13]);
unset($row[13]);
$rows[] = array_merge($row, $industries);
}

分类:php 时间:2015-03-15 人气:0
本文关键词: PHP,数组,while循环
分享到:

相关文章

Copyright (C) 55228885.com, All Rights Reserved.

55228885 版权所有 京ICP备15002868号

processed in 0.420 (s). 10 q(s)