Code: Select all
<?php
//pull fields with values assigned using passed id
$query_rsSpecs = "SELECT * FROM specs_".$category." WHERE prod_id = $products_id";
$rsSpecs = mysql_query($query_rsSpecs, $cateye2);
$row_rsSpecs = mysql_fetch_assoc($rsSpecs);
$totalFields = mysql_num_fields($rsSpecs);
//echo $row_rsSpecs['prod_id']; //making sure the query works! it does
//put field names into array to use for building simple array:
for ($i=0;$i< $totalFields;$i++){
$Fields[] = mysql_field_name($rsSpecs, $i);
}
//put recordset values into a simple array for printing
foreach ($Fields as $value){
$SpecArray[] = $row_rsSpecs['$value'];
}
//define the number of Table rows to make
$totalSpecs = (count($SpecArray);
$Rows = round($totalSpecs/8);
//make the table with the results
echo "<table width=90% border=0 cellpadding=3 cellspacing=3 bgcolor=#CC9999>";
$counter = 8;
$specset = 0;
for ($row = 1; $row< $Rows; $row++){
echo "<tr>";
for ($cells = $specset; $cells< $counter; $cells++){
if ($SpecArray[$cells] != ""){
echo "<td bgcolor=FFFFFF>".$SpecArray[$cells]."</td>";
} else if ($SpecArray[$cells] == "1"){
echo "<td align=center bgcolor=FFFFFF>•</td>";
}
}
echo "</tr>";
$specset = $specset+8;
$counter = $counter+8;
}
?>