跑馬燈中資訊顯示的問題
include_once("conn.php") ;
$show_sql="select username ,telephone from enlist_table order by enlist_id desc limit 10" ;
$show_mysql=mysql_query($show_sql) or die("Could not query".mysql_error()) ;
$show_info=mysql_fetch_array($show_mysql) ;
function fun($str){
$tmpstr="" ;
if(ord(substr($str ,0 ,1))>0xa0){
$tmpstr.=substr($str ,0 ,2) ;
}
else{
$tmpstr.=substr($str ,0 ,1) ;
}
return $tmpstr ;
}
do{
//var_dump($show_info["telephone"]) ;
$name=fun($show_info["username"]) ;
$html_info="
" ;
$html_info .="
- ".$name."*** ".substr($show_info["telephone"] ,0 ,7)."****
" ;
$html_info .="
" ;
}while($show_info=mysql_fetch_array($show_mysql)) ;
?>
echo $html_info;
?>
mysql_close() ;
?>
頁面啟動並執行時候,應該會有幾條資訊在跑動,用var_dump()函數進行輸出,會有幾條結果,但是跑燈的時候,怎麼就只有一條呀!急,謝謝。
------解決方案--------------------
這樣試試
do{
$html_info="" ;
//var_dump($show_info["telephone"]) ;
$name=fun($show_info["username"]) ;
$html_info .="- ".$name."*** ".substr($show_info["telephone"] ,0 ,7)."****
" ;
}while($show_info=mysql_fetch_array($show_mysql)) ;
$html_info .="
" ;