php - Access denied for user 'my_user'@'localhost' (using password: YES) -
can explain means , can fix it?
the error:
access denied user 'my_user'@'localhost' (using password: yes)
my php file:
<?php $mysqli = new mysqli("localhost", "my_user", "my_password", "my_db"); $password = $_post["password"]; $username = $_post["username"]; $statement = mysqli_prepare(mysqli, "select * user username = ? , password = ?"); mysqli_stmt_bind_param($statement, "ss", $username, $password); mysqli_stmt_execute($statement); mysqli_stmt_store_result($statement); mysqli_stmt_bind_result($statement, $userid, $name, $age, $username, $password); $user = array(); while(mysqli_stmt_fetch($statement)){ $user[name] = $name; $user[age] = $age; $user[username] = $username; $user[password] = $password; } echo json_encode($user); mysqli_stmt_close($statement); mysqli_close(mysqli); ?>
either database user or password wrong(or both). check again if user exists database on host.
also check case of characters.
Comments
Post a Comment