Home > Backend Development > PHP Tutorial > 跑马灯中信息显示的有关问题

跑马灯中信息显示的有关问题

WBOY
Release: 2016-06-13 12:57:45
Original
865 people have browsed it

跑马灯中信息显示的问题
nbsp;HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">







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{<br />
$html_info="<ul>" ;<br />
//var_dump($show_info["telephone"]) ;<br />
$name=fun($show_info["username"]) ;<br />
$html_info .="<li>".$name."***  ".substr($show_info["telephone"] ,0 ,7)."****</li>" ;<br />
}while($show_info=mysql_fetch_array($show_mysql)) ;<br />
$html_info .="</ul>" ;
Copy after login
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