All pastes #880979 Raw Edit

Miscellany

public php v1 · immutable
#880979 ·published 2008-01-29 21:49 UTC
rendered paste body
<body><table width="813" cellpadding="0" cellspacing="0">  <tr>      <?// sélectionne toutes les fiches de la table $table$query = "SELECT * FROM galerie_cat order by galerie_id DESC"; $result = mysql_query($query);// On choisit de faire trois colonnes$NbCol=2;// Il y a un total de NbTot enregistrements$NbTot=mysql_num_rows($result);// Il va falloir un certain nombre de lignes$NbLigne=1+(int)($NbTot/$NbCol);// Premier enregsitrement$Col=1; // Pour savoir dans quelle colonne on est$Lig=0; // Pour savoir sur quelle ligne on est// tant qu'il y a des ficheswhile ($val = mysql_fetch_array($result)) {      $Valeur=$Col+($Lig*$NbCol);   $SQL = "UPDATE galerie_cat SET galerie_id=".$Valeur   ." WHERE icon_cat ='".$val["icon_cat"]."'";   mysql_query($SQL);   $Lig=$Lig+1;   // si on a fait NbLigne ou si le compteur est supérieur au nombre total   // il faut passer à la colonne suivante et à la première ligne   if (($Lig==$NbLigne) or ($Valeur>($NbTot-$NbCol))) {$Lig=0;$Col=$Col+1;}}// Maintenant que l'ordre a été établi on passe// au vidage du fichier en mode colonnes (NbCol colonnes)// Ouverture de la table triée sur notre champ ordre// Connexion à la base$query="Select * from galerie_cat order by galerie_id";$result=mysql_query($query);echo "<table cellpadding=0>";$Col=1; // Compteur permettant de savoir si on est en début ou en fin de lignewhile ($val = mysql_fetch_array($result)) {      if ($Col==1) {echo "<tr>";}   echo "   <td width = 400><table width = 400 border = 0 cellspacing = 0 cellpadding = 0><tr><td width = 3% rowspan = 2>&nbsp;</td><td align = left  valign = top width = 70%>".$val["name"]."</td><td  width = 24% rowspan = 2 align = left  valign = top><a href='#' class='info'><img src=".$val["icon_cat"]."><span>'.$val["icon_cat"].'<p> This is my tip content </span></a></td><td width = 3% rowspan= 2 align = left  valign = top>&nbsp;</td></tr><tr>  <td align = left  valign = top>".$val["description"]."</td></tr><tr>  <td>&nbsp;</td>  <td align = left  valign = top>&nbsp;</td>  <td align = left  valign = top>&nbsp;</td>  <td align = left  valign = top>&nbsp;</td></tr></table>";   $Col=$Col+1;      If ($Col>$NbCol) {$Col=1;echo "</tr>";}}// Ici, il faut peut-être finir la ligneif ($Col<>1) {   for ($i=$Col;$i<=$NbCol;$i++) {echo "<td>&nbsp;</td>";}   echo "</tr>";   }echo "</table>";?></td>