LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1070|回复: 2

[求助]新手问php问题!急需!

[复制链接]
发表于 2006-4-4 16:34:58 | 显示全部楼层 |阅读模式
<?php
$connid=@mysql_connect("localhost","","");
$sql="select * from user_info";
$result=mysql_db_query("user",$sql);
$name=mysql_result($result,0,"username");
$sex=mysql_result($result,0,"sex");
$email=mysql_result($result,0,"Email");
?>

<html>
<head>
<title>信息</title>
</head>
<body>
<table>
<tr>
<td>用户名:</td>
<td>
<?php
echo $name;
?></td>
<tr>
<td>性&nbsp;别</td>
<td>
<?php
echo $sex;
?></td>
<tr>
<td>Email</td>
<td>
<?php
echo $email;
?></td>
</tr>
</table>
浏览效果,出现错误信息:
Warning: mysql_db_query() [function.mysql-db-query]: Access denied for user 'www-data'@'localhost' (using password: NO) in /var/www/show.php on line 4

Warning: mysql_db_query() [function.mysql-db-query]: A link to the server could not be established in /var/www/show.php on line 4

Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /var/www/show.php on line 5

Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /var/www/show.php on line 6

Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /var/www/show.php on line 7

用户名:
性 别
Email
请大家帮帮忙!哪里出错了!!
发表于 2006-4-5 16:34:34 | 显示全部楼层
Warning: mysql_db_query() [function.mysql-db-query]: Access denied for user 'www-data'@'localhost' (using password: NO) in /var/www/show.php on line 4

很明显的是MYSQL用户登陆错误~~检查一下帐号是不是能用~~
回复 支持 反对

使用道具 举报

发表于 2006-4-6 10:27:42 | 显示全部楼层
用 $connid=@mysql_connect("localhost","root",""); 试试?
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表