showing mysql results differently?
Posted: Mon May 04, 2009 7:55 am
Hi,
I would like to show the first 2 of my returned mysql results as pictures, then the last 4 results as text.
Is this possible?
This is what I have so far but it just shows 6 images.
I would like to show the first 2 of my returned mysql results as pictures, then the last 4 results as text.
Is this possible?
Code: Select all
<?php
// Performing SQL query
$query = 'SELECT * FROM games WHERE category = "retro" ORDER BY rand() DESC LIMIT 6';
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
// Printing results in HTML
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo "<img src="images/$line['title'].jpg>";
}
?>