Category : pdo

I have a problem connecting Laravel to a MySQL database. The project is not inside a docker/homestead virtual box, it’s directly on my PC running Windows 10 (sadly). The .env file looks like that: DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=simac DB_USERNAME=root DB_PASSWORD= When I try to run the migrations with artisan migrate I get the following: simacvendorlaravelframeworksrcIlluminateDatabaseConnectorsConnector.php:70 ..

Read more

I ran the command php artisan and it returned this. PS C:Users715OneDriveDesktoplaravel-tutoriallinks> php artisan migrate IlluminateDatabaseQueryException could not find driver (SQL: select * from information_schema.tables where table_schema = links_development and table_name = migrations and table_type = ‘BASE TABLE’) at C:Users715OneDriveDesktoplaravel-tutoriallinksvendorlaravelframeworksrcIlluminateDatabaseConnection.php:671 667▕ // If an exception occurs when attempting to run a query, we’ll format the ..

Read more

I am a beginner in development and I am trying to translate this laravel code into pdo please thank you. value); $categorie_ref = $categorie->code_categorie; $categorie_id = $categorie->id; if(Produit::where(‘categorie_id’,$categorie_id)->count() == 0){ $codeproduit = $categorie_ref.”_0″; return $codeproduit; }else{ $dernier_produit_categorie = Produit::where(‘categorie_id’, $categorie_id)->orderBy(‘created_at’, ‘desc’)->first(); $get_last_num = explode(“_”, $dernier_produit_categorie->code); return $categorie_ref.’_’.($get_last_num[1]+1); } } ?> Sourc..

Read more

An PDOException(code: 1045) error occurs when laravel connects to mysql yet the credentials allow me to log in via phpmyadmin suggesting the credentials are correct. Error message: (PDOException(code: 1045): SQLSTATE[HY000] [1045] Access denied for user ‘host.domain.com’@’localhost’ (using password: YES) .env file: DB_CONNECTION=mysql DB_HOST=localhost DB_PORT=3306 DB_DATABASE=host.domain.com DB_USERNAME=host.domain.com DB_PASSWORD=password_here PHP version is 7.2.31 Laravel Framework version is ..

Read more

When I tried to migrate the database in my Laravel project it cam up with this error: PDOException::(“SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it. I looked at several other solutions to this problem including many on this site and none of them so far have solved the problem ..

Read more