标题:求助:Warning: mysql_query() [function.mysql-query]: Access denied for ...
取消只看楼主
SillyLou
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2016-5-26
 问题点数:0 回复次数:0 
求助:Warning: mysql_query() [function.mysql-query]: Access denied for user ''@'loc
最近自学php,然后试着写了个程序:
<?php
header("Content-Type:text/html; charset=utf8");
define("DB_HOST","localhost");
define("DB_USER","root");
define("DB_PASS","root");

$id=$_POST['ID'];
$password=$_POST['Password'];
$_sql = file_get_contents('user.sql');
$_arr = explode(';', $_sql);
$_mysqli = new mysqli(DB_HOST,DB_USER,DB_PASS);
if (mysqli_connect_errno()) {
exit('连接数据库出错');
}
else {echo'fun';}
foreach ($_arr as $_value) {
$_mysqli->query($_value.';');
}
//$sql = "select * from user where ID = '$id' and password = '$password'";
    $result = mysql_query("select * from user where ID = '$id' and password = '$password'");

    $rows=mysql_num_rows($result);
if($rows)
{echo '<script>alert("successfully send");location.href=./index.html"</script>';exit();}
else{echo'<script>alert("username or password wrong")</script>';exit();}
$_mysqli->close();
$_mysqli = null;
?>
报错Warning: mysql_query() [function.mysql-query]: Access denied for user ''@'localhost' (using password: NO) in D:\phpStudy\WWW\dcgz\config.php on line 21
请问哪里写错了,怎么改啊谢谢各位大神
搜索更多相关主题的帖子: password 连接数据库 localhost 
2016-07-01 13:57



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-466539-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.080637 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved