DaWolf has asked for the wisdom of the Perl Monks concerning the following question:
and here is the sub that shows them:$sth = $dbh->prepare_cached("SELECT DISTINCT A.p_code, A.busin +ess, A.status, A.value, A.login, A.enc_date, B.name, B.state FROM business A, users B WHERE ORDER BY A.login, A.data_enc_proposta"); } $dbh = SysUtils::Connect; $sth->execute; while (@data = $sth->fetchrow_array()) { $rs = $data[0]; $neg = $data[1]; $st = $data[2]; $vp = $data[3]; $gel = $data[4]; $dte = $data[5]; $gen = $data[6]; $fil = $data[7]; %dados = ($fil => {$gel => {"$dte" => { cliente => "$rs", nego +cio => "$neg", stat +us => "$st", valo +r => "$vp", nome + => "$gen" } } } ); ListaDados();
Well, it's generating multiple results and it returns the wrong manager (the alphabetically first on the users table), so something is going real wrong here...foreach (keys (%dados)) { $vf = "R\$ "; $tf = "R\$ "; $dados{$fil}{$gel}{$dte}{valor} =~ s/\.0000$/\,00/; $vf .= $dados{$fil}{$gel}{$dte}{valor}; if ($cnt eq 0) { $message .= "<TR class=\"texto3\"> <TD colspan=\"4\" BGCOLOR=\"$color2\"><span class =\"texto +2\">$dados{$fil}{$gel}{$dte}{nome}</span></TD> </TR> <TABLE WIDTH=\"100%\" BORDER=\"0\" CELLSPACING=\"0\" CELLP +ADDING=\"0\"> <TR CLASS=\"texto2\"> <TD>Client</TD> <TD>Business</TD> <TD>Status</TD> <TD>Value</TD> </TR> <TR> <TD COLSPAN=\"4\"> <HR> </TD> </TR> <TR CLASS=\"texto3\"> <TD BGCOLOR=\"$color2\">$dados{$fil}{$gel}{$dte}{cliente}< +/TD> <TD BGCOLOR=\"$color2\">$dados{$fil}{$gel}{$dte}{negocio}< +/TD> <TD BGCOLOR=\"$color2\">$dados{$fil}{$gel}{$dte}{status}</ +TD> <TD BGCOLOR=\"$color2\">$vf</TD> </TR>"; $cnt++; ($color2,$color1) = ($color1,$color2); } else { $message .= "<TR CLASS=\"texto3\"> <TD BGCOLOR=\"$color2\">$dados{$fil}{$gel}{$dte}{cliente}< +/TD> <TD BGCOLOR=\"$color2\">$dados{$fil}{$gel}{$dte}{negocio}< +/TD> <TD BGCOLOR=\"$color2\">$dados{$fil}{$gel}{$dte}{status}</ +TD> <TD BGCOLOR=\"$color2\">$vf</TD> </TR>"; ($color2,$color1) = ($color1,$color2); } } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Probelms returning values from a db and putting into a hash
by buckaduck (Chaplain) on Apr 04, 2002 at 20:41 UTC | |
Re: Probelms returning values from a db and putting into a hash
by scain (Curate) on Apr 04, 2002 at 20:18 UTC | |
Re: Probelms returning values from a db and putting into a hash
by trs80 (Priest) on Apr 04, 2002 at 20:54 UTC | |
Re: Probelms returning values from a db and putting into a hash
by petdance (Parson) on Apr 04, 2002 at 20:19 UTC | |
by DaWolf (Curate) on Apr 04, 2002 at 20:24 UTC | |
by petdance (Parson) on Apr 04, 2002 at 20:37 UTC | |
Re: Probelms returning values from a db and putting into a hash
by RMGir (Prior) on Apr 04, 2002 at 20:38 UTC | |
Re: Probelms returning values from a db and putting into a hash
by DaWolf (Curate) on Apr 04, 2002 at 20:27 UTC |