Recuperation & ajout des données calculees
enselme
-
Fallentree Messages postés 2309 Date d'inscription Statut Membre Dernière intervention -
Fallentree Messages postés 2309 Date d'inscription Statut Membre Dernière intervention -
slt ,je fais une application ou j'ai besoin d'additionner les recettes manquantes,or les recettes manquante st calculees,voici comment j'ai calculé les recettes manquante mais les additionner au fure et a mesure g suis bloqué
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;code ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
<?php
session_start();
// information pour la connection à le DB
include"connexion.php";
// connection à la DB
ini_set('display_errors','off');
$link = mysql_connect($local,$user,$pass) or die ('Erreur : '.mysql_error() );
mysql_select_db($db) or die ('Erreur :'.mysql_error());
// requête SQL qui compte le nombre total d'enregistrements dans la table et qui
//récupère tous les enregistrements
$_SESSION['Manquante']='';
$_SESSION['nom'] = '';
$somme_manquante=0;
$select = 'SELECT 'chauffeur'.'codech' ,'nomch', 'prech','nom_type','num_imm','date_vers','sommeversee','sommefixe' FROM 'chauffeur','vehicule','type_vehicule','recette' WHERE 'type_vehicule'.'codetype'= 'vehicule'.'codetype' and 'chauffeur'.'codech' = 'vehicule'.'codech' and 'recette'.'codech'='vehicule'.'codech'';
$result = mysql_query($select,$link) or die ('Erreur : '.mysql_error() );
$total = mysql_num_rows($result);
// si on a récupéré un résultat on l'affiche.
if($total) {
// début du tableau
echo '<table width="98%" height="505" border="2">';
// première ligne on affiche les titres prénom et surnom dans 2 colonnes
echo '<tr>';
echo '<th width="20px" height="10px" style=" border-radius:10px; background:#999;">Nom</td>';
echo '<td width="20px" style=" border-radius:10px; background:#999;" align="center">Prenom</td>';
echo '<td width="20px" style=" border-radius:10px; background:#999;" align="center">Vehicule</td>';
echo '<td width="20px" style=" border-radius:10px; background:#999;" align="center">Numero d Immatriculation</td>';
echo '<td width="20px" style=" border-radius:10px; background:#999;" align="center">Date</td>';
echo '<td width="20px" style=" border-radius:10px; background:#999;" align="center">Recette Versée</td>';
echo '<td width="20px" style=" border-radius:10px; background:#999;" align="center">Recette Normal</td>';
echo '<td width="20px" style=" border-radius:10px; background:#999;" align="center">Recette Manquante</td>';
//echo '<td width="20px" style=" border-radius:10px; background:#999;" align="center">Total Recette Manquante</td>';
echo '</tr>'."\n";
// lecture et affichage des résultats sur 2 colonnes, 1 résultat par ligne.
while($row = mysql_fetch_array($result)) {
$Manquante=$row[7]-$row[6];
$_SESSION['Manquante'] = $Manquante;
echo '<tr>';
// echo '<td bgcolor="#CCCCCC">'.$row[0].'</td>';
echo '<th align="center">'.$row[1].'</th>';
echo '<th align="center">'.$row[2].'</th>';
echo '<th align="center">'.$row[3].'</th>';
echo '<th align="center">'.$row[4].'</th>';
echo '<th align="center">'.$row[5].'</th>';
echo '<th align="center">'.$row[6].'</th>';
echo '<th align="center">'.$row[7].'</th>';
echo '<th align="center">'.$Manquante.'</th>';
echo '</tr>'."\n";
}
echo '</table>'."\n";
// fin du tableau.
}
else echo 'Pas d\'enregistrements dans cette table...';
// on libère le résultat
mysql_free_result($result);
?>
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;code ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
<?php
session_start();
// information pour la connection à le DB
include"connexion.php";
// connection à la DB
ini_set('display_errors','off');
$link = mysql_connect($local,$user,$pass) or die ('Erreur : '.mysql_error() );
mysql_select_db($db) or die ('Erreur :'.mysql_error());
// requête SQL qui compte le nombre total d'enregistrements dans la table et qui
//récupère tous les enregistrements
$_SESSION['Manquante']='';
$_SESSION['nom'] = '';
$somme_manquante=0;
$select = 'SELECT 'chauffeur'.'codech' ,'nomch', 'prech','nom_type','num_imm','date_vers','sommeversee','sommefixe' FROM 'chauffeur','vehicule','type_vehicule','recette' WHERE 'type_vehicule'.'codetype'= 'vehicule'.'codetype' and 'chauffeur'.'codech' = 'vehicule'.'codech' and 'recette'.'codech'='vehicule'.'codech'';
$result = mysql_query($select,$link) or die ('Erreur : '.mysql_error() );
$total = mysql_num_rows($result);
// si on a récupéré un résultat on l'affiche.
if($total) {
// début du tableau
echo '<table width="98%" height="505" border="2">';
// première ligne on affiche les titres prénom et surnom dans 2 colonnes
echo '<tr>';
echo '<th width="20px" height="10px" style=" border-radius:10px; background:#999;">Nom</td>';
echo '<td width="20px" style=" border-radius:10px; background:#999;" align="center">Prenom</td>';
echo '<td width="20px" style=" border-radius:10px; background:#999;" align="center">Vehicule</td>';
echo '<td width="20px" style=" border-radius:10px; background:#999;" align="center">Numero d Immatriculation</td>';
echo '<td width="20px" style=" border-radius:10px; background:#999;" align="center">Date</td>';
echo '<td width="20px" style=" border-radius:10px; background:#999;" align="center">Recette Versée</td>';
echo '<td width="20px" style=" border-radius:10px; background:#999;" align="center">Recette Normal</td>';
echo '<td width="20px" style=" border-radius:10px; background:#999;" align="center">Recette Manquante</td>';
//echo '<td width="20px" style=" border-radius:10px; background:#999;" align="center">Total Recette Manquante</td>';
echo '</tr>'."\n";
// lecture et affichage des résultats sur 2 colonnes, 1 résultat par ligne.
while($row = mysql_fetch_array($result)) {
$Manquante=$row[7]-$row[6];
$_SESSION['Manquante'] = $Manquante;
echo '<tr>';
// echo '<td bgcolor="#CCCCCC">'.$row[0].'</td>';
echo '<th align="center">'.$row[1].'</th>';
echo '<th align="center">'.$row[2].'</th>';
echo '<th align="center">'.$row[3].'</th>';
echo '<th align="center">'.$row[4].'</th>';
echo '<th align="center">'.$row[5].'</th>';
echo '<th align="center">'.$row[6].'</th>';
echo '<th align="center">'.$row[7].'</th>';
echo '<th align="center">'.$Manquante.'</th>';
echo '</tr>'."\n";
}
echo '</table>'."\n";
// fin du tableau.
}
else echo 'Pas d\'enregistrements dans cette table...';
// on libère le résultat
mysql_free_result($result);
?>
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
A voir également:
- Recuperation & ajout des données calculees
- Fuite données maif - Guide
- Trier des données excel - Guide
- Sauvegarde des données - Guide
- Supprimer les données de navigation - Guide
- Logiciel de récupération de données - Guide