Connection issues
Closed this issue · 8 comments
I can connect to my database using straight PDO. But, cannot connect using easydb. It gives PDO connection error. Check username & password. I am using V2.0.0 with Php 7.2. In addition, the error displays username and password and would like to suppress those.
What does your code look like (with username/password censored) when you instantiate EasyDB?
declare(strict_types = 1);
require 'vendor/autoload.php';
$db = \ParagonIE\EasyDB\Factory::create('mysql:host=localhost;dbname=temp;', 'root', 'xxxxxx');
// $db = new PDO('mysql:host=localhost;dbname=temp;', 'root', 'xxxxxx');
echo true;
Interesting. I'll look through the Factory class in the morning.
In the meantime, if you do $db = new EasyDB(new PDO(/* ... */));
you can solve your immediate problem.
ok thank you.
When I ran the following code:
<?php
declare(strict_types = 1);
require 'vendor/autoload.php';
$db = new EasyDB(new PDO('mysql:host=localhost;dbname=temp;', 'root', 'xxxx'));
echo true;
I get the following error:
Fatal error: Uncaught Error: Class 'EasyDB' not found in D:\WAMP\Apache24\htdocs\dbdemo\dbdemo.php:14 Stack trace: #0 {main} thrown in D:\WAMP\Apache24\htdocs\dbdemo\dbdemo.php on line 14
See attached for directory and composer.json
You need to import the namespace or use a fully qualified class name.
+ use ParagonIE\EasyDB\EasyDB;
// ...
$db = new EasyDB(new PDO('mysql:host=localhost;dbname=temp;', 'root', 'xxxx'));
or
- $db = new EasyDB(new PDO('mysql:host=localhost;dbname=temp;', 'root', 'xxxx'));
+ $db = new ParagonIE\EasyDB\EasyDB(new PDO('mysql:host=localhost;dbname=temp;', 'root', 'xxxx'));
It's been a while. If this hasn't been resolved, please let me know and I'll reopen.