一个小疑点 在线请求解答
程序员文章站
2024-01-30 22:13:52
...
一个小问题 在线请求解答
$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);
$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);
相关文章
相关视频