php - Warning: mysql_connect(): Access denied for user 'root'@'localhost' (using password: YES) -
warning: mysql_connect(): access denied user 'root'@'localhost' (using password: yes) in c:\xampp\htdocs\login\sessionhandler.php on line 35
so what's on line 35.
//to make connection database $conn = mysql_connect("localhost", "root", "password") or die(mysql_error());
i don't know whether problem or code i'm writing. have searched every possible answer not looking for.
this code (if problem not on line 35)
//validation error flag $errflag = false; //input validation if($_post['uname'] == '') { $errmsg_arr[]='login id missing'; $errflag = true; } if($_post['pword'] == '') { $errmsg_arr[] = 'password missing'; $errflag = true; } //if there input validations, redirect login form if($errflag) { $_session['errmsg_arr'] = $errmsg_arr; session_write_close(); header("location: login.php"); exit(); } //to make connection database $conn = mysql_connect("localhost", "root", "password") or die(mysql_error()); //to select targeted database mysql_select_db("ngchoonching", $conn) or die(mysql_error()); //to create query executed in sql $username = $_post['uname']; $password = $_post['pword']; $query = "select * profile username = '$username' , password = '$password'"; //to run sql query in database $result= mysql_query($query, $conn) or die(mysql_error()); //check whether query successful or not if(isset($result)) { if(mysql_num_rows($result) == 1) { //login successful session_regenerate_id(); $member = mysql_fetch_assoc($result); $_session['sess_member_id'] = $member['id']; $_session['sess_first_name'] = $member['firstname']; $_session['sess_last_name'] = $member['lastname']; $_session['status'] = true; session_write_close(); header("location: login-successful.php"); exit(); } else { //login failed header("location: login-failed.html"); exit(); } } else { die("query failed"); } ?>
i use localhost,phpmyadmin,xampp , don't understand why access denied.
try $conn = mysql_connect("localhost", "root")
or $conn = mysql_connect("localhost", "root", "")
Comments
Post a Comment