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 -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]