一个小疑点 在线请求解答

WBOY
Release: 2016-06-13 13:50:02
Original
822 people have browsed it

一个小问题 在线请求解答
$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);

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!