Jump to content


hugo

Member Since 13/03/2004
Offline Last Active 11/05/2011, 20:58
-----

Posts I've Made

In Topic: Duvida Listagem Em Tabelas

17/12/2010, 17:06

calixtorj@hotmail.com

In Topic: Duvida Listagem Em Tabelas

17/12/2010, 17:00

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<table width="736" border="1">
  <tr>
    <td>Nome:</td>

    <td>Dia do Vencimento</td>
  </tr>
  <?php 
  
include ('conectar.php');
$mes_atual = date("m");
$ano_atual = date("Y");
$sql = mysql_query("SELECT * FROM faturas where status = 'off' AND MONTH(data_vencimento) = '$mes_atual' AND YEAR(data_vencimento) = '$ano_atual'") or die(mysql_error());
// eu tirei o group by day.... se tiver mais de uma fatura no mesmo dia, ia dar problema
while ($dados_faturas = mysql_fetch_array($sql)) {

list($ano,$mes,$dia) = explode("-",$dados_faturas['data_vencimento'] );

$url = "index.php?pagina=Busca&chave=$dia/$mes/$ano&cat=data_vencimento&status_fatura=off";

// falta o where e consultar quem é o cliente, o nome do campo na tabela cliente é ID ? é o nome do campo na tabela faturas é o que, arruma aqui embaixo
$tabela_cliente = mysql_query("SELECT * FROM clientes where id=".$dados_clientes['xxxxxxxxxxxxxxxx']." ");
while ($dados_clientes = mysql_fetch_array($tabela_cliente)) {

// arruma o nome do clienbte
?>
  <tr>
    <td><?php echo $dados_clientes['xxxxxxxxxx'] ; ?></td>

    <td><?php echo $dados_faturas['data_vencimento'] ; ?></td>
	
   </tr>	
  <?php }} ?>
  
  </tr>
</table>
</body>
</html>











Turista

while ($dados_clientes = mysql_fetch_array($tabela_cliente)) {
?>
<tr>
<td><?php echo $dados_clientes ; ?></td>

<td><?php echo $dados_faturas ; ?></td>
<?php }} ?>

</tr> ESSE TR ESTA FORA DO WHILE, MAS MESMO ASSIM ACHO QUE TEM COISA ERRADO COM SEU SCRIPT

O que exatamente você quer fazer?
por alto entendi que você quer buscar as faturas e depois imprimir o vencimento com o nome do cliente ao lado
é ísso ?




Olá gente tenho esse seguinte codigo...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<table width="736" border="1">
  <tr>
    <td>Nome:</td>

    <td>Dia do Vencimento</td>
  </tr>
  <?php include ('conectar.php');
$mes_atual = date("m");
$ano_atual = date("Y");
$sql = mysql_query("SELECT * FROM faturas where status = 'off' AND MONTH(data_vencimento) = '$mes_atual' AND YEAR(data_vencimento) = '$ano_atual' GROUP BY DAY(data_vencimento)") or die(mysql_error());
while ($dados_faturas = mysql_fetch_array($sql)) {
list($ano,$mes,$dia) = explode("-",$dados_faturas[data_vencimento]);
$url = "index.php?pagina=Busca&chave=$dia/$mes/$ano&cat=data_vencimento&status_fatura=off";
$tabela_cliente = mysql_query("SELECT * FROM clientes");
while ($dados_clientes = mysql_fetch_array($tabela_cliente)) {
?>
  <tr>
    <td><?php echo $dados_clientes[nome]; ?></td>

    <td><?php echo $dados_faturas[data_vencimento]; ?></td>
  <?php }} ?></tr>
</table>
</body>
</html>

ele ta listando os campos duplicadamente!

quero listar assim
___________________________
Nome | Dia de Vencimento

Cliente 1 | 14/12/2010

Cliente 1 | 17/12/2010

Cliente 2 | 15/12/2010
-----------


isso mesmo hugo, soh que esta imprimidno porem desorganizado !

segue o demo... e tbm ta repetindo o resultado duplicando o mesmo

http://ventosulnet.d...ras_abertas.php

!


In Topic: Duvida Listagem Em Tabelas

17/12/2010, 16:51

Turista

while ($dados_clientes = mysql_fetch_array($tabela_cliente)) {
?>
<tr>
<td><?php echo $dados_clientes ; ?></td>

<td><?php echo $dados_faturas ; ?></td>
<?php }} ?>

</tr> ESSE TR ESTA FORA DO WHILE, MAS MESMO ASSIM ACHO QUE TEM COISA ERRADO COM SEU SCRIPT

O que exatamente você quer fazer?
por alto entendi que você quer buscar as faturas e depois imprimir o vencimento com o nome do cliente ao lado
é ísso ?



Olá gente tenho esse seguinte codigo...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<table width="736" border="1">
  <tr>
    <td>Nome:</td>

    <td>Dia do Vencimento</td>
  </tr>
  <?php include ('conectar.php');
$mes_atual = date("m");
$ano_atual = date("Y");
$sql = mysql_query("SELECT * FROM faturas where status = 'off' AND MONTH(data_vencimento) = '$mes_atual' AND YEAR(data_vencimento) = '$ano_atual' GROUP BY DAY(data_vencimento)") or die(mysql_error());
while ($dados_faturas = mysql_fetch_array($sql)) {
list($ano,$mes,$dia) = explode("-",$dados_faturas[data_vencimento]);
$url = "index.php?pagina=Busca&chave=$dia/$mes/$ano&cat=data_vencimento&status_fatura=off";
$tabela_cliente = mysql_query("SELECT * FROM clientes");
while ($dados_clientes = mysql_fetch_array($tabela_cliente)) {
?>
  <tr>
    <td><?php echo $dados_clientes[nome]; ?></td>

    <td><?php echo $dados_faturas[data_vencimento]; ?></td>
  <?php }} ?></tr>
</table>
</body>
</html>

ele ta listando os campos duplicadamente!

quero listar assim
___________________________
Nome | Dia de Vencimento

Cliente 1 | 14/12/2010

Cliente 1 | 17/12/2010

Cliente 2 | 15/12/2010
-----------


In Topic: Dados Do Mysql Em Botoes 'Select' De Formulario

10/11/2010, 14:18

<?
// faz o select das categorias e detro do while você deixa o option
while .... {
?>
<option value="<?=$categoria?>"><?=$categoria?></option>...
<?
}
?>

In Topic: Envio Automático De E-Book Através Do Php + Pagseguro

27/10/2010, 22:28

Complementando...

Você precisará se preocupar com o retorno da compra, tratar o mesmo e mediante o status da transação rodar o script que enviará o e-mail com o link para o seu cliente

Um abraço e boa sorte

IPB Skin By Virteq