0

Illuminate\Database\Connection::runQueryCallback C:\wamp\www\LaravelProject\vendor\laravel\framework\src\Illuminate\Database\Connection.php:671

ERROR:

Illuminate\Database\QueryException SQLSTATE[42S02]: Base table or view not found: 1146 Table 'db_laravel.registers' doesn't exist (SQL: insert into registers (name, email, updated_at, created_at) values (dfmgkm, kmfgk, 2020-09-08 04:56:41, 2020-09-08 04:56:41))

" I couldn't insert values to the MySQL because of the connection failure, it's an error in Connection.php file, but my migration is success "

DB_CONNECTION=mysql

DB_HOST=127.0.0.1

DB_PORT=3306

DB_DATABASE=db_laravel

protected function runQueryCallback($query, $bindings, Closure $callback)

{

    try {

        $result = $callback($query, $bindings);

    }

    catch (Exception $e) {

        throw new QueryException(

            $query, $this->prepareBindings($bindings), $e

        );

    }



    return $result;

}
sarath
  • 1
  • 1
  • 2
  • What is the full error that you are getting? And what is the value of `DB_CONNECTION` in the `.env` file – Prince Dorcis Sep 07 '20 at 22:19
  • Illuminate\Database\QueryException SQLSTATE[42S02]: Base table or view not found: 1146 Table 'db_laravel.registers' doesn't exist (SQL: insert into `registers` (`name`, `email`, `updated_at`, `created_at`) values (dmf, ldfmgk, 2020-09-08 05:38:45, 2020-09-08 05:38:45)) DB_CONNECTION=mysql – sarath Sep 08 '20 at 05:39
  • Check if the `registers` table exists in your database and in your migration file if there is no typo in the table's name. – Prince Dorcis Sep 08 '20 at 06:45

3 Answers3

2

This happened to me after upgrading from php8.0 to php8.1. The solution was to install php extensions for the newer version. In my case:

sudo apt install php8.1-{imagick,bz2,curl,gd,mysql,opcache,xml}

In your case, you probably just need

sudo apt install phpX.X-mysql

where X.X is your php version

murume
  • 154
  • 1
  • 3
  • 13
0

Try doing this

composer update

composer require doctrine/dbal
Swarnadeep
  • 325
  • 1
  • 3
  • 17
  • I was done these two things that you have suggested, but the error has occurred again, it not be cleared. – sarath Sep 08 '20 at 05:33
-1

When updating you should check the method. You should make it 'PUT'and make method spoofing @method('PUT') in the form

  • This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/31710182) – jrswgtr May 11 '22 at 10:00