- 分享
- 0
- 人气
- 0
- 主题
- 188
- 帖子
- 3680
- UID
- 311368
- 积分
- 314
- 阅读权限
- 15
- 注册时间
- 2010-4-7
- 最后登录
- 2017-7-16
- 在线时间
- 17435 小时
|
我用xampp当我的localhost...
以下是我写的code...
在当我要test login能不能成功时....我的username = ash...password = pass....
可是它就出现问题了...
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: NO) in C:\xampp\htdocs\login\login.php on line 13
Couldn't connect to database
line 13 是我highlight的那里..
这到底是那里写错了??
有谁知道..帮帮下我..
<?php
session_start();
$username = $_POST['username'];
$password = $_POST['password'];
if ($username&&$password)
{
$connect = mysql_connect("localhost", "root", "") or die ("Couldn't connect to database");
mysql_select_db("member") or die ("Couldn't find database");
$quiery = mysql_query("SELECT * FROM login WHERE username='$username'");
$numrows = mysql_num_rows($query);
if($numrows !=0)
{
while ($row = mysql_fetch_assoc($query))
{
$dbusername = $row['username'];
$dbpassword = $row['password'];
}
if ($username==$dbusername&&$password==$dbpassword)
{
echo "Login successful. <a href='membersarea.php'>Click here to enter the members are</a>";
$_SESSION['username']=$dbusername;
}
else
echo "Invalid Password!";
}
else
die ("That username doesn't exist!");
}
else
die ("Please re-enter username & password.");
?> |
|