| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 4526 人关注过本帖
标题:求助:Warning: mysql_query() [function.mysql-query]: Access denied for ...
只看楼主 加入收藏
SillyLou
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2016-5-26
收藏
 问题点数:0 回复次数:1 
求助: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
为瞬间停留
Rank: 1
等 级:新手上路
威 望:1
帖 子:14
专家分:4
注 册:2016-6-13
收藏
得分:0 
为什么前面面向对象,后面又用面向过程那,编程要统一呀
2016-07-12 16:03
快速回复:求助:Warning: mysql_query() [function.mysql-query]: Access denie ...
数据加载中...
 
   



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

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