Rebonsoir,
Plusieurs choses que je ne comprend pas ?
1/ Pourquoi il faut mettre
$reponse = mysql_query("SELECT nom_module FROM modules_x10 WHERE nom_module='lumiere salon'");
Ce qui me surprend c'est qu'il faut specifier 'nom_module='lumiere salon' car si le nom change c'est la caca Non , car 'nom_module='lumiere salon' ne sera plus valable ??? alors comment faire pour que le nouveau ce reaffiche, car si il faut a chaque fois remodifier la page php, escusé moi de l'expression mais c'est la chiot ', deplus il faut que le nom puisse être modifier. Mysql ne permet pas ceci !
2 / J'ai 256 Modules donc dans ma page il faut que j'affiche les 256 nom ecrit dans la table, a savoir nom_module, donc j'ai fait un exemple simple avec un tableau html pour afficher 3 noms, ( A savoir dans mon tableau html j'ajoute <?php echo $result1["nom_module"];?> pour y afficher) faut il faire comme ceci pour y completer jusqu'a 256 :
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
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Document sans titre</title>
</head>
<body>
<?php
mysql_connect("localhost", "root", ""); // Connexion à MySQL
mysql_select_db("domotique"); // Sélection de la base de donnée
$reponse1 = mysql_query("SELECT nom_module FROM modules_x10 WHERE nom_module='lumiere salon'");
$reponse2 = mysql_query("SELECT nom_module FROM modules_x10 WHERE nom_module='lumiere couloir'");
$reponse3 = mysql_query("SELECT nom_module FROM modules_x10 WHERE nom_module='lumiere couloir'");
$result1=mysql_fetch_assoc($reponse1);
$result2=mysql_fetch_assoc($reponse2);
$result3=mysql_fetch_assoc($reponse3);
mysql_close(); // Fermeture de la connexion Mysql
?>
<table width="335" border="1">
<tr>
<th width="80" scope="col">nom</th>
<th width="50" scope="col">C.M.U </th>
<th width="50" scope="col">On</th>
<th width="30" scope="col">OFF</th>
<th width="36" scope="col">+</th>
<th width="49" scope="col">-</th>
</tr>
<tr>
<th scope="row"> </th>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<th scope="row"><?php echo $result1["nom_module"]; ?></th>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<th scope="row"><?php echo $result2["nom_module"]; ?></th>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<th scope="row"><?php echo $result3["nom_module"]; ?></th>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
</body>
</html> |
Coordialement.
Partager