Buongiorno a tutti, ho bisogno del vostro aiuto........
devo creare, anzi disegnare, una tabella che prende i dati da DB, non ha un incremento graduale, e quando asse X e Y corrispondono alle giuste coordinate mi deve colorare la giusta cella.... scusate se mi spiego male, ma forse il caldo mi rallenta i neuroni 
cerco di farvi un esempio pratico......
tabella (c=colore cella):
ml/diam |
16 |
22 |
25 |
30 |
35 |
5 |
c |
|
|
|
|
10 |
|
c |
c |
|
|
25 |
|
|
c |
c |
c |
il mio DB:
id |
quantita |
diametro |
1 |
5 |
16 |
2 |
10 |
22 |
3 |
10 |
25 |
4 |
25 |
25 |
5 |
25 |
30 |
6 |
25 |
33 |
avevo fatto così, ma sicuramente sbaglio......
Codice PHP:
// Inizio tabella
$a=0;
$b=0;
echo '<table border="1"><tr>
<td>ml</td>
';
//for ($y=$newY; $y<=120; $y+=$incr) {
$queryQ=mysql_query("SELECT * FROM `misure` GROUP BY `quantita`");
$totQ = mysql_num_rows($queryQ);
while ($rowQ=mysql_fetch_row($queryQ)) {
foreach(explode(",",$rowQ[1]) as $y) {
// Inizio riga
$queryD=mysql_query("SELECT * FROM `misure` GROUP BY `diametro`");
$totD = mysql_num_rows($queryD);
while ($rowD=mysql_fetch_row($queryD)) {
foreach(explode(",",$rowD[2]) as $x) { // Fine riga
echo 'a'.$a.' - b'.$b.' - y'.$y.' - x'.$x.' - rowD[1]'.$rowD[1].' - rowD[2]'.$rowD[2].' <br>';
if ($a==0 && $b==0) {
echo '
<td>x'.$x.'</td>
';
}
elseif ($a==0 && $b!=$totD-1) {
echo '<td>x'.$x.'</td>
';
}
elseif ($a==0 && $b==$totD-1) {
echo '<td>x'.$x.'</td>
</tr>
<tr>
<td>y'.$y.'</td>
';
}
elseif ($a!=0 && $b==0) {
echo '<tr>
<td>y'.$y.'</td>
';
}
$b++;
}
$queryC=mysql_query("SELECT * FROM `misure`");
while ($rowC=mysql_fetch_row($queryC)) {
if ($y==$rowC[1] && $x==$rowC[2]) {
$class=' class="lav"';
}
else {
$class='';
}
echo '<td'.$class.'> </td>
';
}
}
$b=0;
// Fine riga
echo '</tr>
';
}
$a++;
}
echo '</table>';
// Fine tabella
help help help
grazie