一个小问题 在线请求解答
$query = "select ncc from City";
$result=mysql_query($query);
while(list($ncc) = mysql_fetch_row($result)){
$a=$ncc.',';
//echo $a;
}
$string="$a";
我希望将所有数据库的ncc数值全部传给$a 让$string="所有ncc";如何实现 谢谢了
------解决方案--------------------$a-'';
while(list($ncc) = mysql_fetch_row($result)){
$a.=$ncc;
}
$string=$a;
------解决方案--------------------$a = '';
$query = "select ncc from City";
$result=mysql_query($query);
while(list($ncc) = mysql_fetch_row($result)){
$a .=$ncc.',';
//echo $a;
}
$string="$a";
------解决方案--------------------少了个等号:
$a='';
while(list($ncc) = mysql_fetch_row($result)){
$a.=$ncc;
}
$string=$a;
------解决方案--------------------while(list($ncc[]) = mysql_fetch_row($result));
array_pop($ncc);
$string = join(',', $ncc);