unire 2 query e calcoli matematici

« Older   Newer »
  Share  
maxmaxuell
view post Posted on 24/8/2011, 11:26     +1   -1




Ciao Seven...
come puoi vedere nella foto ... ho il seguente problema
il totale + iva devo metterlo a fianco anzicchè a capo

t333

http://max400scuola.altervista.org/aaa/somma-db-2.php

ho provato con html ma non và....

t111
CODICE
<?php

include("dati-connessione-al-database.php");

//----------------------- il 20% di 50 ---------------------------
$query3 = "SELECT ceiling(((prezzo*quantita)*20)/100) AS totale2 FROM tabella";
$query_results3 = mysql_query($query3);

$i2 = 0;
while($fetch3 = mysql_fetch_array($query_results3)) {
    $i2++;
    echo "il 20% di 50 è: <font color=red><b>".$fetch3['totale2']."</b></font><br>";  
    }
//----------------------------------------------------------------

//------------ il semplice totale --------------------------------

$query = "SELECT `id`,`prezzo`,`quantita`, (prezzo * quantita) as totale FROM tabella";
$query_results = mysql_query($query);

$i = 0;

while($fetch = mysql_fetch_array($query_results)) {
    $i++;

echo ""."<table border=1><tr><td width=20>.".$i."</td><td width=100>"."-".$fetch['id']."</td>";
echo ""."<td width=100>Prezzo:<br>".$fetch['prezzo']."</td>";
echo ""."<td width=100>Quantità:<br>".$fetch['quantita']."</td>";
echo ""."<td width=100>Totale:<br>".$fetch['totale']."</td></tr></table>";
}
//------------------------------------------------------------

//------------ aggiungere il il 20% al totale di 50 -----------------
$query4 = "SELECT ceiling((prezzo*quantita)+(((prezzo*quantita)*20)/100)) AS totale_con_iva FROM tabella";
$query_results4 = mysql_query($query4);

$i3 = 0;
while($fetch4 = mysql_fetch_array($query_results4)) {
    $i3++;
    echo ""."<table border=1><tr><td width=20><td width=100> Totale + iva: <br>".$fetch4['totale_con_iva']."</td></tr></table>";  
    }
//--------------------------------------------------------------------

?>


http://max400scuola.altervista.org/aaa/somma-db-2.php
 
Top
1 replies since 24/8/2011, 11:26   128 views
  Share