rendered paste body <?php
include ('backend/db.php');
$query = "SELECT id, title, author, category, post, DATE_FORMAT(date, '%M %d, %Y') as sd FROM blogposts";
$result = mysql_query($query);
if ($result) {
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo '<div class="post-cont">';
echo "\n" . "\t" . "\t" . "\t";
echo '<div class="title">';
echo "\n" . "\t" . "\t" . "\t" . "\t";
echo '<h2>'.$row['title'].'</h2>';
echo "\n" . "\t" . "\t" . "\t";
echo '</div>';
echo "\n" . "\t" . "\t" . "\t";
echo '<div class="post">';
echo "\n" . "\t" . "\t" . "\t" . "\t";
echo '<p>'.$row['post'].'</p>';
echo "\n" . "\t" . "\t" . "\t";
echo '</div>';
echo "\n" . "\t" . "\t" . "\t";
echo '<div class="credit">';
echo "\n" . "\t" . "\t" . "\t" . "\t";
echo '<p>Posted by <b>'.$row['author'].'</b> on '.$row['sd'].' under <b>'.$row['category'].'</b>.</p>';
echo "\n" . "\t" . "\t" . "\t";
echo '</div>';
echo "\n" . "\t" . "\t";
echo '</div>';
}
} else {
echo 'Currently, there are no posts to display.';
}
}
?>