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
/* ------------------ VARIABLE NOM DE LA BDD ------------------ */
$nom_bdd = "vehicule";
/* ------------------ VARIABLE NOMS DES TABLES ------------------ */
$nom_table1 ="vehicule1";
$nom_table3 ="vehicule1_options";
/* ------------------ CONNEXION A LA BDD ------------------ */
mysql_connect("localhost", "root", ""); // Connexion à MySQL
mysql_select_db("$nom_bdd"); // Sélection de la base de donnée
/* ------------------ REQUETE 1 SQL DE LA TABLE 1 ------------------ */
$reponse = mysql_query("SELECT * FROM $nom_table1 "); // Requête SQL
$donnees = mysql_fetch_assoc($reponse); // liste ce que contient la table
/* ------------------ REQUETE 2 SQL DE LA TABLE 1 ------------------ */
$requete2 = mysql_query("SELECT km FROM $nom_table1 LIMIT 1 , 9999999999999999999 "); // Requête SQL
$donnees2 = mysql_fetch_assoc($requete2); // liste ce que contient la table
/* ------------------ REQUETE 3 SQL DE LA TABLE 3 - OPTIONS ------------------ */
$reponse3 = mysql_query("SELECT * FROM $nom_table3"); // Requête SQL
$donnees3 = mysql_fetch_assoc($reponse3); // liste ce que contient la table
?>
</p>
<p align="center">Vehicule <?php echo $donnees3["vehicule"]; ?> <?php echo $donnees3["marque"]; ?> <?php echo $donnees3["model"]; ?> </p>
<table width="auto" align="center" border="0">
<tr>
<th width="auto" bgcolor="#999999" scope="col">Id</th>
<th width="auto" bgcolor="#999999" scope="col"><LABEL for="checkbox_row_2">date</LABEL></th>
<th width="auto" bgcolor="#999999" scope="col"><LABEL for="checkbox_row_3">km</LABEL></th>
<th width="auto" bgcolor="#999999" scope="col">km2</th>
<th width="auto" bgcolor="#999999" scope="col">Volume</th>
<th width="auto" bgcolor="#999999" scope="col"><LABEL for="checkbox_row_5">prix litres ht carburant</LABEL></th>
<th width="auto" bgcolor="#999999" scope="col"><LABEL for="checkbox_row_6">tva carburant</LABEL></th>
<th width="auto" bgcolor="#999999" scope="col"><LABEL for="checkbox_row_7">montant ttc carburant</LABEL></th>
<th width="auto" bgcolor="#999999" scope="col">Nombre kilometre éffectuer</th>
<th width="auto" bgcolor="#999999" scope="col"><LABEL for="checkbox_row_8">action</LABEL></th>
<th width="auto" bgcolor="#999999" scope="col"><table cellspacing="0" cellpadding="0">
<tr>
<TD align="middle"></TD>
<TH noWrap><LABEL for="checkbox_row_12">commentaire</LABEL></TH>
</tr>
</table></th>
</tr>
<tr>
<th scope="row"> </th>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<?php
while ($donnees = mysql_fetch_array($reponse) and ($donnees2 = mysql_fetch_array($requete2)))
{
?>
<tr>
<th bgcolor="#CCCCCC" scope="row"><?php echo $donnees["id"]; ?></th>
<td bgcolor="#CCCCCC"><?php echo $donnees["date"]; ?></td>
<td bgcolor="#CCCCCC"><?php echo $donnees["km"]; ?></td>
<td bgcolor="#CCCCCC"><?php echo $donnees2["km"]; ?></td>
<td bgcolor="#CCCCCC"><?php echo $donnees["volume"]; ?></td>
<td bgcolor="#CCCCCC"><?php echo $donnees["prix_litres_ht_carburant"]; ?></td>
<td bgcolor="#CCCCCC"><?php echo $donnees["tva_carburant"]; ?></td>
<td bgcolor="#CCCCCC"><?php echo $donnees["montant_ttc_carburant"]; ?></td>
<td bgcolor="#CCCCCC"><?php echo $difference_kilometre = $donnees2["km"] - $donnees["km"] ; ?></td>
<td bgcolor="#CCCCCC"><?php echo $donnees["action"]; ?></td>
<td bgcolor="#CCCCCC"><?php echo $donnees["motant_ttc_action"]; ?></td>
</tr>
<?php } //toute la ligne est comprise dans la boucle while?>
</table>
<p align="center">[<a href="/maison/N4/index.php">Accueil</a>] - [<a href="/maison/N4/index.php?page=at">Sommaire</a>] - [<a href="index.php?page=at-ins">Ajouter</a>] - [<a href="index.php?page=at-mod">Modifier</a>] - [<a href="index.php?page=at-mod">Supprimer</a>] - [<a href="index.php?page=at-rec">Rechercher</a>]</p>
<br/>
</body>
</html>
<?php
mysql_close(); // Fermeture de la connexion Mysql
?> |
Partager