Information Display in the marquee & lt ;! DOCTYPE & nbsp; HTML & nbsp; PUBLIC & nbsp;-W3CDTD & nbsp; HTML & nbsp; 4.01 & nbsp; TransitionalEN & nbsp; www. w3.orgTRhtml4loose. dtd & gt; & lt; html & gt; & lt; head & gt; information display in the marquee
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 ("cocould 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 ();
?>
When the page is running, there should be several pieces of information running, and the var_dump () function is used for output, there will be several results, but when the light is running, how can there be only one! Urgent. thank you.
------ Solution --------------------
Try this way
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 .="
" ;