On my site, I am trying to make the code below add a new box for each news article in the database.
So far i have only managed to get it to output the first article in a box before it puts all the articles inside the first articles's box rather than a box of their own. (If that was a bit hard to understand, i have put 2 images to show how i need it to work)
Currently it does this:
I need it to do this
the code i have so far is.
PHP Code:
<?php
$query = mysql_query('SELECT * FROM news ORDER BY id DESC LIMIT 1');
while($output = mysql_fetch_assoc($query))
{
?>
<div class="bs-docs-example">
<div class="accordion" id="accordion2">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#<?php echo $output['id']; ?>">
<?php
echo $output['subject'].'<br />';
?>
</a>
</div>
<div id="<?php echo $output['id']; ?>" class="accordion-body collapse">
<?php
echo '<div class="accordion-inner">';
echo $output['news'].'<br / >'; ?>
<br>
<br><blockquote class="pull-right"><?php
echo 'Posted by '.$output['postedby'];
?>
</blockquote>
<?php } ?>
</div>
</div>
</div>
</div>
</div>