SetQuery($s"/> SetQuery($s">
关于循环数组合并的问题
foreach ($keyword as $val){
$sql="Select title from XXXX title like '%$val%' limit 10 ";
$list = array();
$dsql->SetQuery($sql);
$dsql->Execute();
while ($row = $dsql->GetArray()) {
$list[] = $row;
}
}
结果是这样的。 请问怎么合并 并去除重复。。
Array
(
[0] => Array
(
[title] => 1111111111
)
[1] => Array
(
[title] => 22222222222
)
[2] => Array
(
[title] =>333333333333
)
)
Array
(
[0] => Array
(
[title] => 1111111111
)
)
------解决方案--------------------
$list = array(); foreach ($keyword as $val){ $sql="Select title from XXXX title like '%$val%' limit 10 "; $dsql->SetQuery($sql); $dsql->Execute(); $array = array(); while ($row = $dsql->GetArray()) { array_push($array,$row); } $list[] = $array; } print_r($list); <div class="clear"> </div>