<? echo"$mes"; $sql="SELECT nome_devedor,desc_conta,valor_conta,venc_conta, tipo_conta, status_conta FROM debitos_copy,devedor WHERE status_conta = 01 and debitos_copy.cod_devedor1 = devedor.codigo_devedor and substring(debitos_copy.venc_conta,6,2)=$mes"; $query = @mysql_query($sql); if (!$query){ die ("Problemas ao executar o sql !!!"); } else { $total = mysql_num_rows($query); if($total == 0) { echo "Não existem contas a vencer este mês"; } else { if($total>0) echo "Existem $total contas a vencer no mês $mes"; while ($coluna = @mysql_fetch_array($query)){ $nome = $coluna["nome_devedor"]; $descricao = $coluna["desc_conta"]; $vencimento = $coluna["venc_conta"]; $valor = $coluna["valor_conta"]; $status = $coluna["status_conta"]; $tipo = $coluna["tipo_conta"]; //echo "<b>$nome</b><br>$descricao<br>$vencimento<br>$valor<br>$status<br><br>"; } } } ?> <table width="96%" border="1"> <tr> <td width="20%"><div align="center"><strong><font size="1" face="Verdana">Quem Paga</font></strong></div></td> <td width="22%"><div align="center"><strong><font size="1" face="Verdana">Descrição</font></strong></div></td> <td width="21%"><div align="center"><strong><font size="1" face="Verdana">Vencimento</font></strong></div></td> <td width="18%"><div align="center"><strong><font size="1" face="Verdana">Valor R$</font></strong></div></td> <td width="1%"><div align="center"><strong><font size="1" face="Verdana">Tipo</font></strong></div></td> <td width="18%"><div align="center"><strong><font size="1" face="Verdana">Status</font></strong></div></td> </tr> <tr> <td><div align="center"><font size="1" face="Verdana"><?$coluna = @mysql_fetch_array($query))){ echo"$nome"; ?></font></div></td> <td><div align="center"><font size="1" face="Verdana"><?php echo"$descricao"; ?></font></div></td> <td><div align="center"><font size="1" face="Verdana"><?php echo"$vencimento"; ?></font></div></td> <td><div align="center"><font size="1" face="Verdana"><?php echo"$valor"; ?></font></div></td> <td><div align="center"><font size="1" face="Verdana"><?php echo"$tipo"; ?></font></div></td> <td><div align="center"><font size="1" face="Verdana"><?php echo"$status"; } ?></font></div></td> </tr> </table> <? mysql_close($conn); ?> </body> </html> axo q aí... falou