Home >Backend Development >PHP Tutorial >PHP调用数据库数据输出结果总重复一次
求助:PHP调用数据库数据输出结果总重复一次。
表里有两条内容:
1111111111111111111111111
2222222222222222222222222
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><?php //设置数据库变量$db_host = 'localhost';$db_user = 'root';$db_passw = '123456';$db_name = 'freebb';$conn = mysql_connect($db_host,$db_user,$db_passw) or die ('数据库连接失败!');mysql_query("set names 'utf8'");mysql_select_db($db_name,$conn) or die('数据库选定失败!');$sql = "SELECT * FROM `member` ORDER BY `id` DESC LIMIT 0, 16";$result = mysql_query($sql) or die('数据库查询失败!'); while($mem = mysql_fetch_object($result)) //循环开始{ $username = $mem->username; $bbsname = $mem->bbsname; $bbstype = $mem->bbstype;?>