简体   繁体   English

用户'@'localhost'的Webmatrix访问被拒绝(使用密码:否)

[英]Webmatrix Access denied for user ''@'localhost' (using password: NO)

I have a problem with a mysqli_query in this code: 我在以下代码中遇到mysqli_query的问题:

  <?php

  session_start();
  $user = $_POST['user'];
  $pwd = $_POST['pwd'];
  include "connect.php";


  if ($user && $pwd){

  // infos provided
  $queryget=mysqli_query("SELECT * FROM Tmembers WHERE user='$user' AND pwd='$pwd'");
  $numrows=mysqli_num_rows("$queryget");

 if ($numrows !=0){
                    $_SESSION['user'] =$user;
                    echo "you have successfully logged in .";
                  }

 else echo "you r not a member, please sign in  ";
               }

                else{
                        echo "you didn't enter any entries !!!";
                        include "connect.php";
                     }
  ?>

it returns this error : Access denied for user ''@'localhost' (using password: NO) 它返回此错误:用户“ @'localhost”的访问被拒绝(使用密码:否)

I am working on webmatrix, with a Mysql database not (sql server) and I connected to it successfuly via connect.php, and it has a password, the table Tmembers has two colomns user and pwd, I don't know how to fix this access bug 我正在使用非Mysql数据库(sql服务器)的webmatrix上工作,并且我通过connect.php成功连接到它,并且它具有密码,表Tmembers具有两个colomns用户和pwd,我不知道如何解决此访问错误

The error states no password was specified even though it exists in the code. 该错误表明即使代码中存在密码,也未指定密码。 So basically the error does not match the statement mysqli_connect("localhost", "root"... which means the database thinks you aren't even attempting to connect in the first place. 因此,基本上该错误与mysqli_connect("localhost", "root"...语句不匹配mysqli_connect("localhost", "root"...这意味着数据库认为您甚至根本没有尝试连接。

Try replacing mysqli_connect() with mysql_connect() see if that helps. 尝试用mysql_connect()替换mysqli_connect()看看是否有帮助。

The first parameter of mysqli_query should be the connection resource from your connect statement. mysqli_query的第一个参数应该是来自connect语句的连接资源。 Then pass your sql query string as a second parameter. 然后将您的sql查询字符串作为第二个参数传递。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 用户&#39;XXX&#39;@&#39;localhost&#39;的访问被拒绝(使用密码:否) - Access denied for user 'XXX'@'localhost' (using password: NO) 用户&#39;linuxuser&#39;@&#39;localhost&#39;的访问被拒绝(使用密码:否) - Access Denied for user 'linuxuser'@'localhost' (using password: no) 用户“ @&#39;localhost”的访问被拒绝(使用密码:NO)phpmyadmin - Access denied for user ''@'localhost' (using password: NO) phpmyadmin 用户&#39;name&#39;@&#39;localhost&#39;的访问被拒绝(使用密码:NO) - Access denied for user 'name'@'localhost' (using password: NO) 用户“ @&#39;localhost”的访问被拒绝(使用密码:NO) - Access denied for user ''@'localhost' (using password: NO) 用户&#39;root&#39;@&#39;localhost&#39;的访问被拒绝(使用密码:NO) - Access denied for user 'root'@'localhost' (using password: NO) 用户&#39;consult&#39;@&#39;localhost&#39;的访问被拒绝(使用密码:否) - Access denied for user 'consult'@'localhost' (using password: NO) 用户 &#39;apache&#39;@&#39;localhost&#39; 访问被拒绝(使用密码:NO) - Access denied for user 'apache'@'localhost' (using password: NO) 用户&#39;root&#39;@&#39;localhost&#39;访问被拒绝(使用密码:NO); - Access denied for user 'root'@'localhost' (using password: NO); 用户 'user'@'localhost' 的访问被拒绝(使用密码:YES)错误 - Access denied for user 'user'@'localhost' (using password: YES) error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM