Jump to content


Photo

Duvida Listagem Em Tabelas


  • Faça o login para participar
6 replies to this topic

#1 williamkevenis

williamkevenis

    Normal

  • Banidos
  • PipPip
  • 99 posts
  • Sexo:Masculino
  • Localidade:Maceio
  • Interesses:PHP, CSS, JS

Posted 17/12/2010, 16:45

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
-----------
Att, William Kévenis. A simplicidade é o último degrau da sabedoria.
Posted Image Meu post lhe ajudou? Reputar/votar é uma das formas de agradecer.

#2 hugo

hugo

    Super Gestão - Soluções para Internet

  • Usuários
  • 174 posts
  • Sexo:Masculino
  • Localidade:São Paulo
  • Interesses:Trocar conhecimentos (ajudar e também aprender)

Posted 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
-----------


Super Gestão - Desenvolvimento de Sites e Sistemas
.................................................................
Anuncie grátis
.................................................................

#3 williamkevenis

williamkevenis

    Normal

  • Banidos
  • PipPip
  • 99 posts
  • Sexo:Masculino
  • Localidade:Maceio
  • Interesses:PHP, CSS, JS

Posted 17/12/2010, 16:58

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

!
Att, William Kévenis. A simplicidade é o último degrau da sabedoria.
Posted Image Meu post lhe ajudou? Reputar/votar é uma das formas de agradecer.

#4 hugo

hugo

    Super Gestão - Soluções para Internet

  • Usuários
  • 174 posts
  • Sexo:Masculino
  • Localidade:São Paulo
  • Interesses:Trocar conhecimentos (ajudar e também aprender)

Posted 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

!


Super Gestão - Desenvolvimento de Sites e Sistemas
.................................................................
Anuncie grátis
.................................................................

#5 williamkevenis

williamkevenis

    Normal

  • Banidos
  • PipPip
  • 99 posts
  • Sexo:Masculino
  • Localidade:Maceio
  • Interesses:PHP, CSS, JS

Posted 17/12/2010, 17:05

<!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

!


Deu esse erro abaixo hugo


Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /var/www/abelhafin-2/faturas_abertas.php on line 31

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /var/www/abelhafin-2/faturas_abertas.php on line 31

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /var/www/abelhafin-2/faturas_abertas.php on line 31
Nome: 	Dia do Vencimento

quer me ajudar no sistema ?

conversamos por msn te passo os fontes completos + sql!
Att, William Kévenis. A simplicidade é o último degrau da sabedoria.
Posted Image Meu post lhe ajudou? Reputar/votar é uma das formas de agradecer.

#6 hugo

hugo

    Super Gestão - Soluções para Internet

  • Usuários
  • 174 posts
  • Sexo:Masculino
  • Localidade:São Paulo
  • Interesses:Trocar conhecimentos (ajudar e também aprender)

Posted 17/12/2010, 17:06

calixtorj@hotmail.com
Super Gestão - Desenvolvimento de Sites e Sistemas
.................................................................
Anuncie grátis
.................................................................

#7 williamkevenis

williamkevenis

    Normal

  • Banidos
  • PipPip
  • 99 posts
  • Sexo:Masculino
  • Localidade:Maceio
  • Interesses:PHP, CSS, JS

Posted 17/12/2010, 17:08

calixtorj@hotmail.com

ja adicionei entra e acc!
Att, William Kévenis. A simplicidade é o último degrau da sabedoria.
Posted Image Meu post lhe ajudou? Reputar/votar é uma das formas de agradecer.




1 user(s) are reading this topic

0 membro(s), 1 visitante(s) e 0 membros anônimo(s)

IPB Skin By Virteq