1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
| <?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
include("include/variables.inc.php");
$liendb = mysql_connect($bddserver, $bddlogin, $bddpassword);
mysql_select_db ($bdd);
mysql_set_charset( 'utf8' );
//include('include/var.inc.php');
$pays = ( PHP_OS == "Windows" ) ? 'fra' : 'fr_FR';
setlocale ( LC_TIME, $pays ) ;
//$id = $_POST['id'];
$result = mysql_query ("SELECT
IDNPlace,
NumPlace,
Reférence,
Personnes.IDPersonne,
Personnes.Nom_Personne,
Personnes.Prenom_Personne,
Personnes.Paiement,
Personnes.Motet,
Instruments.Instrument,
Concert.IDconcert,
Concert.titreconcert,
Concert.lieu,
DATE_FORMAT ( Concert.dateconcert, '%d/%m/%Y' ) AS datecon,
SUM(Prix.Prix) AS prixtotal,
Prix.IDPrix,
Prix.Prix
FROM Tab_NumPlace
INNER JOIN Personnes ON Tab_NumPlace.IDPersonne = Personnes.IDPersonne
INNER JOIN Instruments ON Personnes.IDInstruments = Instruments.IDInstruments
INNER JOIN Concert ON Tab_NumPlace.IDconcert = Concert.IDconcert
INNER JOIN Zones ON Tab_NumPlace.IDZone = Zones.IDZone
INNER JOIN Prix ON Zones.IDPrix = Prix.IDPrix
WHERE Concert.IDconcert = '1'
GROUP BY IDconcert, IDPersonne");
$current_IDconcert = ['IDconcert'];
while ($row = mysql_fetch_assoc($result)) {
$tblConcert[$row['IDconcert']] = $row;
}
$current_IDconcert = NULL;
// on lit le détail des billets
$result = mysql_query
("SELECT
IDNPlace,
NumPlace,
Reférence,
Personnes.IDPersonne,
Personnes.Nom_Personne,
Personnes.Prenom_Personne,
Personnes.Paiement,
Personnes.Motet,
Instruments.Instrument,
Concert.IDconcert,
Concert.titreconcert,
Concert.lieu,
DATE_FORMAT ( Concert.dateconcert, '%d/%m/%Y' ) AS datecon,
Zones.IDZone,
Zones.Zone,
Prix.IDPrix,
SUM(Prix.Prix) AS prixbillets,
COUNT(Prix.Prix) AS nbillets
FROM Tab_NumPlace
INNER JOIN Personnes ON Tab_NumPlace.IDPersonne = Personnes.IDPersonne
INNER JOIN Instruments ON Personnes.IDInstruments = Instruments.IDInstruments
INNER JOIN Concert ON Tab_NumPlace.IDconcert = Concert.IDconcert
INNER JOIN Zones ON Tab_NumPlace.IDZone = Zones.IDZone
INNER JOIN Prix ON Zones.IDPrix = Prix.IDPrix
WHERE Concert.IDconcert = '1'
GROUP BY IDPersonne, IDPrix
ORDER BY IDconcert, IDPersonne");
while ($row = mysql_fetch_assoc($result)) {
// quand on arrive sur un concert différent
if ($row['IDconcert'] !== $current_IDconcert) {
// on affiche les infos de ce concert prises dans le tableau construit avant
echo 'Instrument, Nom, Prénom : ' . $row['Instrument'] . ' ' . $row['Nom_Personne'] . ' ' . $row['Prenom_Personne'] . ' Prix total : ' . $row['prixtotal'] . '<br/>';
// puis on affiche les infos des billets venant de la deuxème requête
echo 'Nombre de billets : ' . $row['nbillets'] . ' Prix billets ' . $row['prixbillets'] . '<br/>';
}}
?> |