Hola que tal, aqui tienes un ejemplo 
  Código PHP:
     
if (($tabla=="loteria") and ($act=="ver"))
{
 $sql = mysql_query("SELECT * FROM Loterias ORDER BY codigo_loteria ASC");
echo '<html>
      <head>
      <title>Consultando Loterias</title>
      </head>
      <body>
     <table border="1" align="center" cellspacing="1" style="border-collapse: collapse" width="75%" id="table1">
        <tr>
                <td width="26%">
                <p align="center"><font face="Arial" size="2"><b>Código de la Loteria</b></font></td>
                <td width="32%">
                <p align="center"><font face="Arial" size="2"><b>Nombre de la Loteria</b></font></td>
                <td>
                <p align="center"><b><font face="Arial" size="2">Activa</font></b></td>
                <td colspan="4">
                <p align="center"><b><font face="Arial" size="2">Acción</font></b></td>
        </tr>
';
$color = "#FFFFE1";
$cantidad=mysql_num_rows($sql);
while($row=mysql_fetch_array($sql)){
  if ($color == "#FFFFE1")
   {
    $color = "#DBF0FB";
   }
   else
   {
    $color = "#FFFFE1";
   }
if ($cantidad == 0)
{
   echo '
      <tr bgcolor="'.$color.'">
         <td width="26%">'.$row[codigo_loteria].'</td>
         <td width="32%">'.$row[nombre].'</td>
         <td width="56">'.$row[activa].'</td>
         <td width="24">
         <a href="util.php?id='.$row[codigo_loteria].'&action=insertar&tab=loteria">
         <img border="0" alt="Insertar Loteria" src="../image/Botones/b_insrow.png" width="16" height="16"></td>
         <td width="21">
         <img border="0" alt="Editar Loteria" src="../image/Botones/b_insrow.png" width="16" height="16"></td>
         <td width="23">
         <img border="0" alt="Desactivar Loteria" src="../image/Botones/b_drop.png" width="16" height="16"></td>
         <td width="29"></td>
    </tr>
';
}
else
    {
   echo '
      <tr bgcolor="'.$color.'">
         <td width="26%">'.$row[codigo_loteria].'</td>
         <td width="32%">'.$row[nombre].'</td>
         <td width="56">'.$row[activa].'</td>
         <td width="25" align="center">
         <a href="util.php?id='.$row[codigo_loteria].'&action=insertar&tab=loteria">
         <img border="0" alt="Insertar Loteria" src="../image/Botones/b_insrow.png" width="16" height="16"></td>
         <td width="26" align="center">
         <a href="util.php?id='.$row[codigo_loteria].'&action=editar&tab=loteria">
         <img border="0" alt="Editar Loteria" src="../image/Botones/b_edit.png" width="16" height="16"></td>
         <td width="21" align="center">
         <a href="ver.php?id='.$row[codigo_loteria].'&action=ver&tab=loteria">
         <img border="0" alt="Ver Loterias" src="../image/Botones/b_browse.png" width="16" height="16"></td>
         <td width="28" align="center">
         <a href="util.php?id='.$row[codigo_loteria].'&action=eliminar&tab=loteria">
         <img border="0" alt="Desactivar Loterias" src="../image/Botones/b_drop.png" width="16" height="16"></td>
    </tr>
';
    }
 
}
  if ($color == "#FFFFE1")
   {
    $color = "#DBF0FB";
   }
   else
   {
    $color = "#FFFFE1";
   }
echo '<tr bgcolor="'.$color.'">
      <td width="26%"></td>
      <td width="32%" align="center">
      <input name=idclose type=button value="Cerrar" onclick="window.close()" style="border: 1px solid #000080">
      </td>
      <td width="4%"></td>
      <td width="4%"></td>
      <td width="4%"></td>
      <td width="4%"></td>
      <td width="4%">
      </td>
    </tr>
      </table>
      </body>
      </html>
     ';
} 
    
  
Suerte y Salu2. 
Bye