'Laravel open db file extension
I can't open a database with PDO on Laravel. Here is my example what it works without Laravel framework on a simple PHP file and on framework don't want to work.
That is the simple php file without Laravel:
$pdo = new PDO('sqlite:filename.DB');
$statement = $pdo->query("select * from test");
$result = $statement ->fetchAll(PDO::FETCH_ASSOC);
That is how I try to get the same result with Laravel:
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Database\Connection;
use PDO;
class Teszt extends Controller {
public function teszt(){
$pdo = new PDO('sqlite:filename.db');
$statement = $pdo->query("select * from test");
$result = $statement ->fetchAll(PDO::FETCH_ASSOC);
dump($result);
}
}
On image is the error. I have the table logs on that database: Error Database
Solution 1:[1]
I found the problem...
$db = new PDO("sqlite:".__DIR__."/SYNOSYSLOGDB__ARCH.db");
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Silimon Barabas Szili |
