no save
Assistance
Achat
News

Forum | programmation
[SQL] requête : obtenir le total
Riwalenn, le ven. 15 sept. 2006 à 17:49:16
Bonjour,

sous le code suivant, j'aimerais obtenir le total genre SUM(Stock.Quantity), mais j'obtiens une erreur si je le fait.. quelqu'un peut-il me dire quoi mettre ? Merci d'avance !

<?
include ("connexion_stock.php");
?>
<html>
<head>
</head>
<body>
<?
$sqlconnect=odbc_connect($dsn,$username,$password);
$sqlquery="SELECT Products.ProductName, Products.ProductDesc, Products.type, Stock.Quality FROM Products, Stock where Products.ProductName=Stock.ProductName and Products.Type <> 'S'
Group by Products.ProductName, Products.ProductDesc, Products.type, Stock.Quality order by Products.ProductName, Products.Type;" or die (mysql_error());
$process=odbc_exec($sqlconnect, $sqlquery);
?>
<html>
<head>
<title>Etat du Stock</title>
<link href="../resolutions/style.css" rel="stylesheet" type="text/css">
</head>

<body>
<p align="center"><b><font face="Arial" size="5">Eurosource Stock Report</font></b></p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<table width="90%" border="0" align="center" cellpadding="1" cellspacing="1">
<tr class="tab04">
<td>
<div align="center">ProductName</div></td>
<td>
<div align="center">ProductDesc</div></td>
<td>
<div align="center">Quality</div></td>
<td>
<div align="center">Quantity</div></td>
<td>
<div align="center">Type</div></td>
</tr>
<?php while(odbc_fetch_row($process)){ $ProductName = odbc_result($process,"ProductName"); $ProductDesc = odbc_result($process,"ProductDesc"); $Type = odbc_result($process,"Type"); $Quality = odbc_result($process,"Quality"); ?>
<tr class="tab05">
<td><?php echo $ProductName ; ?></td>
<td><?php echo $ProductDesc ; ?></td>
<td><div align="center"><?php echo $Quality ; ?></div></td>
<td><div align="center"></div></td>
<td><div align="center"><?php echo $Type ; ?></div></td>
</tr><?php }odbc_close($sqlconnect); ?>
</table>

</body>
</html>
</body>
</html>



Maxg59
sept. 06
Suivant
REPONSES
Maxg59
sept. 06
michelatoutfox
sept. 06
Riwalenn
sept. 06
phunk
sept. 06
Riwalenn
sept. 06
Version Web
Réalisé par RedShift
no save