Show sourcecode
The following files exists in this folder. Click to view.
add-article.php
aside.php
blokket-default.php
data/
initiate.php
remove-article.php
show-all-articles.php
show-article.php
update-article.php
update-article_backup.php
show-all-articles.php
1 lines ASCII Unix (LF)
<?php
$db = new PDO("sqlite:incl/blokket2/data/ads");
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); // Display errors, but continue script.
$stmt = $db->prepare('SELECT * FROM Ads;');
$stmt->execute();
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
?>
<h1>Show all articles</h1>
<table>
<tr>
<th>Name</th>
<th>Description</th>
</tr>
<?php
$contents = null;
foreach($rows as $row)
{
$contents .= "<tr>
<td>" . $row['title'] . "</td >
<td>" . "<img class='left' src='" . $row['image'] . "' width='100' alt='Product image'>" . $row['description'] . "</td>
</tr>";
}
echo $contents;
?>
</table>