Hello everyone, i working on a website and i wanna grab data from a table in my database . specifically the last 4 rows that are entered as the database is updated automatically by users. i wanna be able to display each row separately in different div tags. i'm getting a bit of trouble. As i think the data from the table has to be stored in an array and i'm a bit weak in that area. here's what i've done thus far. an example of my div out put is shown below the php tags
<?php
//Perform database query
$results = mysql_query("SELECT Title FROM News ORDER BY Newsid DESC", $db);
if (!$results) {
die("Database query failed: " . mysql_error());
}
while($row = mysql_fetch_array($results))
{
if($row[6] == 0)
{
if(strlen($row[4]) > 600)
{
$brief = substr($row[4], 0, 600) . '...';
}
else
{
$brief = $row[4];
}
}
else
{
$brief = $row[5];
}
}
?>
<div>
<img src="images/image01.jpg" alt="alt text" title="description "/>
<h3><?php echo $row[?] ?></h3>
<p> </p>
<a href="http://www.google.com">Link #1</a>
</div>