27 lines
662 B
PHP
Executable File
27 lines
662 B
PHP
Executable File
<?php
|
|
$pdo;
|
|
try {
|
|
$pdo = new PDO($dsn, $user, $passwd);
|
|
// if ($pdo) echo "Connected to the $dbname database successfully!";
|
|
|
|
} catch (PDOException $e) {
|
|
echo $e->getMessage();
|
|
}
|
|
|
|
function get_images($pdo) {
|
|
$stmt = $pdo->prepare("SELECT * FROM images;");
|
|
$stmt->execute();
|
|
$data = $stmt->fetchAll();
|
|
|
|
$img_list = '<ul class="img_list">';
|
|
foreach ($data as $block) {
|
|
$img_list .= '<li>';
|
|
$img_list .= '<img src=\''.$block['img_path'].'\'><br>';
|
|
$img_list .= '<h4>'.$block['img_title']."<br></h4>";
|
|
$img_list .= '<p>'.$block['img_desc']."</p>";
|
|
$img_list .= '</li>';
|
|
}
|
|
$img_list .= '</ul>';
|
|
echo $img_list;
|
|
}
|