1.问题:用php读mysql中的一张表,怎么也读不出来,页面有时空白,有时有php中的一小节代码,苦调了一天了,求指导!感激不尽!!
2.mysql中,数据库:test;表名:apple;(字段:firstname,lastname)
3.index.php(试过连接数据库成功)
代码:
<html>
<head>
<title>php分页示例</title>
<meta http-equiv="content-Type" content="text/html; charset=utf-8">
</head><body>
<?php
$dbh = @mysql_connect("localhost","root","");
if(!$dbh){die("error");}
@mysql_select_db("test", $dbh);
$sql = "SELECT * FROM apple";
?>
<?
$rs = mysql_query($sql, $dbh);
while($row = mysql_fetch_array($rs))
echo $row[id];
echo $row[name];
echo '<br/>';
?>
<?
@mysql_close($dbh);
?>
</body>
</html> 请各大侠帮帮忙,叩谢!!
2.mysql中,数据库:test;表名:apple;(字段:firstname,lastname)
3.index.php(试过连接数据库成功)
代码:
<html>
<head>
<title>php分页示例</title>
<meta http-equiv="content-Type" content="text/html; charset=utf-8">
</head><body>
<?php
$dbh = @mysql_connect("localhost","root","");
if(!$dbh){die("error");}
@mysql_select_db("test", $dbh);
$sql = "SELECT * FROM apple";
?>
<?
$rs = mysql_query($sql, $dbh);
while($row = mysql_fetch_array($rs))
echo $row[id];
echo $row[name];
echo '<br/>';
?>
<?
@mysql_close($dbh);
?>
</body>
</html> 请各大侠帮帮忙,叩谢!!
php.ini打开错误提示,重启apache 然后 将出错内容贴出display_errors = On
error_reporting = E_ALL或者直接在代码前添加ini_set("display_errors", "On");
error_reporting(E_ALL);刷新代码将错误提示贴出
[Sun May 27 17:37:28 2012] [error] [client 127.0.0.1] File does not exist: E:/WAMP/wamp/www/favicon.ico
这个是什么啊?网上都查不到啊
<head>
<title>php分页示例</title>
<meta http-equiv="content-Type" content="text/html; charset=utf-8">
</head>
<body>
<?php
$dbh = mysql_connect("localhost","root","yk");
if(!$dbh){die("error");}
mysql_select_db("yuankai", $dbh);
$sql = "SELECT * FROM yuankai_club";
?>
<?p
$rs = mysql_query($sql, $dbh);
while($row = mysql_fetch_array($rs))
{echo $row[no];
echo $row[name];
echo $row[sex]
echo '<br/>';
}
?>
<?p
mysql_close($dbh);
?>
</body>
但是无法读取mysql中 数据库名yuankai 数据表yuankai_club 字段 no name sex 网页显示空白 是怎么回事 谢谢