add db postgre
This commit is contained in:
parent
35a6ac59fb
commit
74ff9fcc3a
@ -1,7 +1,9 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . "/../model/MusicModule.php";
|
||||
require_once __DIR__ . "/../view/View.php";
|
||||
namespace App\Controller;
|
||||
use App\Model\MusicModel;
|
||||
use App\Veiw\View;
|
||||
// require_once __DIR__ . "/../model/MusicModule.php";
|
||||
// require_once __DIR__ . "/../view/View.php";
|
||||
class AboutController
|
||||
{
|
||||
public function actionIndex()
|
||||
@ -12,6 +14,6 @@ class AboutController
|
||||
'box' => $result,
|
||||
'body' => 'To home',
|
||||
'auth' => false
|
||||
], 'tpl_layout.php'));
|
||||
], 'index_tpl.php'));
|
||||
}
|
||||
}
|
||||
|
16
engine/test_db.php
Normal file
16
engine/test_db.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
try {
|
||||
$host = '127.127.126.49';
|
||||
$dbname = 'music';
|
||||
$user = 'music';
|
||||
$password = '123';
|
||||
$port = 5432; // Default PostgreSQL port
|
||||
|
||||
$dsn = "pgsql:host=$host;port=$port;dbname=$dbname;user=$user;password=$password";
|
||||
$db = new PDO($dsn);
|
||||
$query = $db->query('SELECT * FROM top_chart');
|
||||
var_dump($query->fetchAll(PDO::FETCH_ASSOC));
|
||||
echo "Connected to PostgreSQL successfully!";
|
||||
} catch (PDOException $e) {
|
||||
echo "Connection failed: " . $e->getMessage();
|
||||
}
|
Loading…
Reference in New Issue
Block a user