3 column by n rows table

From: Date: Wed, 26 Dec 2001 13:23:24 +0000
Subject: 3 column by n rows table
Groups: php.general 
Request: Send a blank email to php-general+get-78773@lists.php.net to get a copy of this message
Hi list, I have a script that grab data from mysql and generate a table order by name and with images at the beggining of each new letter, something like a index. My problem is that I need to buil a table with 3 column by n row. The problem of creating the <tr> etc is ok! But I can't figure out how to stop the table and initiate another <tr> if the letters change, someone can help?? Here is my code that generate the letters and Index for them: $ultletra = ''; $row = ''; while($resultado = $query->dados()) { $curletra = $resultado['letra']; if($curletra != $ultletra) { $row .= "<tr>\n<td>\n<img src=\"img/letras/$curletra.gif\" width=\"24\" height=\"24\">\n</td>\n</tr>\n"; } $row .= "<td><a href=\"interna.php?cat=$resultado[Nome_Categoria]&celebID=$resultado[CelebID ]\">".$resultado['Nome_Artistico']."</a></td>\n"; $ultletra = $curletra; } and the sql command is: SELECT categorias.Nome_Categoria,celebridades.CelebID,celebridades.Nome_Artistico, lcase(left(Nome_Artistico,1)) as letra FROM categorias LEFT JOIN celebridades ON categorias.CategoriaID=celebridades.Categoria WHERE CategoriaID='1' ORDER BY Nome_Artistico Thank's in advance Rodrigo Peres --

« previous php.general (#78773) next »