Log in

View Full Version : Group by Make...



nikomou
07-15-2008, 03:05 PM
Hello, i have this script below to show mobile phones available on a network. is it possible to group the handsets by Make adding the manufacturers name before the products?? e.g.

Nokia Mobile phones
n80, n95, etc

Sony Ericson Mobile Phones
w800i, w850i, etc


Thanks




$conn = mysql_connect($address, $username, $password);
$rs = mysql_select_db($db, $conn);
$sql="SELECT * FROM Offers WHERE NetworkName='$GetNet' GROUP BY ModelName ORDER BY ModelCreated DESC";
$rs = mysql_query($sql, $conn);
$j = 0;
echo("<table><tr>");
while($row = mysql_fetch_array($rs)) {

$ID = $row[xx];
$Make = $row[xxx];

echo("<td width='137'><p align='center'><b>");
echo("<br><a class=\"menusmall\" href=\"xxx.html\"><img alt=\"$Make $Name\" src=\"xxx\" border=\"0\"></a><br><br>");
echo("</td>");

$j++;
if(($j % 4) == 0) echo("</tr>\n<tr>");
}
echo("</tr></table>");
mysql_close();
?>

allahverdi
07-15-2008, 03:40 PM
try to group by manufactures name and echo manufactures name.

Or I didn't understand you what you want.

nikomou
07-15-2008, 07:12 PM
Hey,

Thanks for the quick reply! what i want to do is to have a manufacturer heading.. so when it changes, it will echo the manufacturers name once, before the products..

similar to this
http://www.mobiles4everyone.com/phones.asp?date=300

allahverdi
07-16-2008, 04:44 AM
I said how to do it. Or you need query?