ciao a tutti,
qualcuno mi sa dire perchè mi brucia sempre un record?
se i record sono 5 ne stampa 4, se sono 4 ne stampa 3....codice:function cat_staff($conn){ $query = "SELECT *FROM `cat_staff` ORDER BY `posizione` ASC"; $es = mysql_query($query, $conn) or die(mysql_error()); $totalRows_es = mysql_num_rows($es); $stampa .='<tr>'; if($totalRows_es > 0){ $row_es = mysql_fetch_assoc($es); $divido = $totalRows_es / 2; $nm = floor($divido); $xn = 0; $stampa .= '<td>'; do{ if($xn < $nm){ $stampa .= '<table width="339" border="0" cellspacing="0" cellpadding="0">'; $id = $row_es['id']; $categoria = $row_es['categoria']; $posizione = $row_es['posizione']; $query_staff = "SELECT * FROM `staff` WHERE `id_staff` = '$id'"; $es_staff = mysql_query($query_staff, $conn) or die(mysql_error()); $totalRows_es_staff = mysql_num_rows($es_staff); if($totalRows_es_staff > 0){ $stampa .= '<tr><td colspan="2" align="right" class="text_aran " style="padding-right:10px">'.$categoria.'</td></tr> <tr><td colspan="2" align="right" bgcolor="#E67106" class="text_aran " style="padding-right:10px">[img]img/spacer.gif[/img]</td></tr> <tr><td height="8" colspan="2">[img]img/spacer.gif[/img]</td></tr>'; $row_es_staff = mysql_fetch_assoc($es_staff); do{ $id_staff = $row_es_staff['id']; $id_posizione = $row_es_staff['id_staff']; $foto = $row_es_staff['foto']; $descrizione = $row_es_staff['descrizione']; $stampa .= '<tr bgcolor="#EEEEEE"> <td width="61" align="center">[img]img/staff/'.$foto.'[/img]</td> <td style="padding-left:10px">variabile incremento: '.$xn.' n. colonne: '.$nm.' ris. totali: '.$totalRows_es.' Id Staff: '.$id_posizione.'</td></tr> <tr><td colspan="2"></td> </tr>'; }while($row_es_staff = mysql_fetch_assoc($es_staff)); } $xn++; $stampa .= '</table>'; }else{ $stampa .= '</td><td>'; $stampa .= '<table width="339" border="0" cellspacing="0" cellpadding="0">'; $xn = 0; } }while($row_es = mysql_fetch_assoc($es)); $stampa .= '</td>'; } $stampa .='</tr>'; return $stampa; }
grazie mille
![]()

Rispondi quotando