michaelkirby,
Please use [php] and [/php] tags to post your code.
Here is a way to loop through ALL results returned:
<?php
$query = "select * from brief order by createddate DESC";
$result = @mysql_query($query, $connection)
or die ("Unable to preform query.br /> $query<br />".mysql_error());
while ($row = mysql_fetch_assoc($result)) {
?>
title : <?php echo $row['title']?> Description <?php echo $row['description']?> <br />
i++;
<?php
}
If you want to restrict it to 5 results, just add the LIMIT clause to your query
$query = "select * from brief order by createddate DESC LIMIT 5";
Unless you want the entire result to dump to an array and you can play with it as much as you'd like:
$query = "select * from brief order by createddate DESC";
$result = @mysql_query($query, $connection)
or die ("Unable to preform query.br /> $query<br />".mysql_error());
$queryResults = array();
while ($row = mysql_fetch_assoc($result)) {
$queryResults[] = $row;
}
This will make $queryResults a Multi-Dimensional Array
<?php
foreach ($queryResults as $res) {
echo $res['title'].'<br /';
}
?>
In the above example $res becomes the array of results (1 row from the table).
Note: When using mysql_fetch_array the results are returned 'twice', once in an associative array, once in a numerical (first column 0, second as 1, etc)
I hope this helps..