当前位置:Gxlcms > PHP教程 > PHP循环展示数据库内容

PHP循环展示数据库内容

时间:2021-07-01 10:21:17 帮助过:3人阅读

PHP循环显示数据库内容
谁帮我写个PHP循环显示数据库内容的代码。。
主机LOCALHOST
用户root
密码<空>
表test
字段acc


把这个字段里的内容用表格显示出来的代码。

------解决方案--------------------
PHP code


$link=mysql_connect("localhost","root") or die("fail".mysql_error());
mysql_select_db('first',$link) or die('faill'.mysql_error()); 
$query_pag_data = "SELECT acc from test";

$result_pag_data = mysql_query($query_pag_data) or die('MySql Error' . mysql_error());

while ($row = mysql_fetch_array($result_pag_data)) 
{
 //在这里使用$row['acc'] 
}                     

人气教程排行