codice:
<?php
session_start();
include("../functions.php");
startdb();
$page="
<!DOCTYPE html>
<head>
<title></title>
</head>
<body>
";
if($id_categoria){
$query="SELECT id,nome,serie,modello,descrizione,pictureName,qualità,commento FROM articoli WHERE id_categoria=$_GET[id_categoria] ORDER BY nome";
}
if($id_sottocategoria){
$query="SELECT id,nome,serie,modello,descrizione,pictureName,qualità,commento FROM articoli WHERE id_sottocategoria=$_GET[id_sottocategoria] ORDER BY nome";
}
$result=mysql_query($query);print mysql_error();
while(list($id_articolo,$nome,$serie,$modello,$descrizione,$pictureName,$qualità,$commento)=mysql_fetch_row($result)){
$page.="
<table border='0' width='722' id='table1' style='border-collapse: collapse'>
<tr>
<td height='21' width='720' bgcolor='#808080' > <p>QUI CI VA IL TITOLO</p></td>
</tr>
<tr>
<td height='188' width='718' bgcolor='#e1e1e1' style='border-style: solid; border-width: 1px' bordercolor='#000000' align='center'>QUI LA FOTO</td>
</tr>
<tr>
<td style='width:720px;height:100px;border:1px solid red;background-color:green;text-align:center'><p>QUI DOVREBBERO VISUALIZZARSI LE TABELLE CON LE MISURE, che invece sono in alto</p>
<!-- QUESTA PARTE QUI SOTTO INVECE DI STARE DENTRO LA TABELLA CON BORDO ROSSO, SI VISUALIZZA IN ALTO DELLA PAGINA -->
";
$countRighe=0;
echo tr($id_articolo,'misura','MISURA');
echo tr($id_articolo,'setole','SETOLE');
echo tr($id_articolo,'dimensioni','DIMENSIONI');
echo tr($id_articolo,'miscela','MISCELA');
echo tr($id_articolo,'mix','MIX');
echo tr($id_articolo,'fibre','FIBRE');
echo tr($id_articolo,'rasate','RASATE');
echo tr($id_articolo,'sporgenza','SPORGENZA');
echo tr($id_articolo,'diametro','DIAMETRO');
echo tr($id_articolo,'tubo','TUBO');
$page.="
</td>
</tr>
</table>
<br><br><br>
</body>
</html>
";
}
function tr($id_articolo,$campoDb,$titolo){
//print $campoDb;
global $countRighe;
if($campoDb=="misura")$campoDb="misura1,misura2";
$query1="SELECT $campoDb FROM versioni WHERE id_pennello=$id_articolo ORDER BY misura1";
$result1=mysql_query($query1);print mysql_error();
$count=0;
while(list($x,$y)=mysql_fetch_row($result1)){
$count++;
if(mysql_num_rows($result1)>0 && $count==1 && $x){
$countRighe++;
if($countRighe%2==0){ $bgcolor="#eaeaea"; }
else{$bgcolor="#c0c0c0";}
$page.=" <table><tr>
<td width='89' bgcolor='$bgcolor'>
<b><font face='Arial' size='1'>$titolo</font></b></td>
";
}
if(mysql_num_rows($result1)>0 && $x){
if($y)$x=$x."x".$y;
$page.="<td align='center' bgcolor='$bgcolor' width='53'><b><font face='Arial' size='1'>$x</font></b></td>";
}
}
if(mysql_num_rows($result1)>0 && $x){
$page.="</tr></table>";
}
return $page;
}
print $page;
?>