Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php SQLSTATE[42S22]中的Laravel应用程序错误500:未找到列:1054未知列_Php_Mysql_Laravel 5_Xampp - Fatal编程技术网

Php SQLSTATE[42S22]中的Laravel应用程序错误500:未找到列:1054未知列

Php SQLSTATE[42S22]中的Laravel应用程序错误500:未找到列:1054未知列,php,mysql,laravel-5,xampp,Php,Mysql,Laravel 5,Xampp,我在xampp和php 7中有一个laravel应用程序,当我想要登录时,我得到一个错误500,如果我检查存储文件夹中的错误日志,我看到它是以下错误: [2021-04-16 23:36:32] live.ERROR: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'username' in 'where clause' (SQL: select * from `users` where `username` = admin and

我在xampp和php 7中有一个laravel应用程序,当我想要登录时,我得到一个错误500,如果我检查存储文件夹中的错误日志,我看到它是以下错误:

[2021-04-16 23:36:32] live.ERROR: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'username' in 'where clause' (SQL: select * from `users` where `username` = admin and `users`.`deleted_at` is null limit 1)
{"exception":"[object] (Illuminate\\Database\\QueryException(code: 42S22): SQLSTATE[42S22]: Column not found: 1054 Unknown column 'username' in 'where clause' (SQL: select * from `users` where `username` = admin and `users`.`deleted_at` is null limit 1) at 
C:\\xampp\\htdocs\\p2\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Connection.php:664, PDOException(code: 42S22): SQLSTATE[42S22]: Column not found: 1054 Unknown column 'username' in 'where clause' at C:\\xampp\\htdocs\\p2\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Connection.php:326)
这是我第一次见到whit laravel,我不知道如何解决这个问题,第326行和第664行的代码是下一个:

326

  • 只是捕捉到了错误,也许是有用的
  • 我从一家让我实习的公司收到了这份申请,但他们没有给我更多的帮助或指导,他们只是想让它发挥作用。
    我很感激任何能帮助我解决这个问题的评论。

    这意味着
    用户名
    不是
    用户
    表中的一列。你把这个错误理解成不同的意思了吗?我只想知道为什么?如果phpmyadmin中的数据库没有给我任何错误。证明它,将
    show create table users
    编辑到您的问题中。
    public function select($query, $bindings = [], $useReadPdo = true)
    {
        return $this->run($query, $bindings, function ($query, $bindings) use ($useReadPdo) {
            if ($this->pretending()) {
                return [];
            }
    
            // For select statements, we'll simply execute the query and return an array
            // of the database result set. Each element in the array will be a single
            // row from the database table, and will either be an array or objects.
            $statement = $this->prepared($this->getPdoForSelect($useReadPdo)
                              ->prepare($query));
    
            $this->bindValues($statement, $this->prepareBindings($bindings));
    
            $statement->execute();
    
            return $statement->fetchAll();
        });
    }
    
    protected function runQueryCallback($query, $bindings, Closure $callback)
    {
       
        try {
            $result = $callback($query, $bindings);
        }
    
        // If an exception occurs when attempting to run a query, we'll format the error
        // message to include the bindings with SQL, which will make this exception a
        // lot more helpful to the developer instead of just the database's errors.
        catch (Exception $e) {
            throw new QueryException(
                $query, $this->prepareBindings($bindings), $e
            );
        }