I have tried playing around and I think 4 queries or 6 are the only option. Below is what I have come up with at the moment, but still no joy:
$query1 = "SELECT section FROM ss_offers GROUP BY section ORDER BY RAND() LIMIT 0,1";
$query2 = "SELECT section FROM ss_offers GROUP BY section ORDER BY RAND() LIMIT 0,1";
$query3 = "SELECT section FROM ss_offers GROUP BY section ORDER BY RAND() LIMIT 0,1";
$result1 = mysql_query($query1)
or die ("Sorry, problem connecting to table.");
$result2 = mysql_query($query2)
or die ("Sorry, problem connecting to table.");
$result3 = mysql_query($query3)
or die ("Sorry, problem connecting to table.");
$query4 = "SELECT FROM ss_offers WHERE section='$result1' ORDER BY RAND() LIMIT 0,3";
$query5 = "SELECT FROM ss_offers WHERE section='$result2' ORDER BY RAND() LIMIT 0,3";
$query6 = "SELECT * FROM ss_offers WHERE section='$result3' ORDER BY RAND() LIMIT 0,3";
$result4 = mysql_query($query4)
or die ("Sorry, problem connecting to table.");
$result5 = mysql_query($query5)
or die ("Sorry, problem connecting to table.");
$result6 = mysql_query($query6)
or die ("Sorry, problem connecting to table.");
while ($row = mysql_fetch_array($result4))
{
extract ($row);
echo "<img src='$company_logo' width='60' height='60' alt='$company - $offer_title' border='0'>$details";
}
while ($row = mysql_fetch_array($result5))
{
extract ($row);
echo "<img src='$company_logo' width='60' height='60' alt='$company - $offer_title' border='0'>$details";
}
while ($row = mysql_fetch_array($result6))
{
extract ($row);
echo "<img src='$company_logo' width='60' height='60' alt='$company - $offer_title' border='0'>$details";
}
Thanks again for your offer of help. 😕