Bonjour
Je suis débutante en php et mysql 
J'ai réussi à afficher à partir d'un choix dans une liste déroulante des informations liées, mais là je souhaite afficher des informations issues de plusieurs tables à la place des informations affichées.
C'est pour ça que je sollicite votre aide, pour me dire où je peux mettre ma requête
select * from host,hostgroup,hostgroup_relation where host_id==host_host_id and hostgroup_hg_id=hg_id
dans ce code
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
| <?php
$connexion=mysql_connect('xxx.xx.xx.xxx','root','') or die ("connexion impossible.");
$db=mysql_select_db('centreon',$connexion) or die ("base de donné non accessible");
$SQL_C="select * from hostgroup";
$result_C = mysql_query($SQL_C)or die(mysql_error());
$str="";
$i=0;
while ($val_C = mysql_fetch_array($result_C,MYSQL_ASSOC))
{
foreach($val_C as $key => $value){
if($key!="hg_id"){
$values[$val_C['hg_id']][$key]=$value;
}
}
$str.="<option value='".$val_C['hg_id']."'>".$val_C['hg_id']."</option>";
}
mysql_close($connexion);
$str_div="";
foreach($values as $key => $value){
$str_div.="<div id='".$key."' style='display:none'>";
$str_div.="<ul>";
foreach($value as $key_value => $rslt){
$str_div.="<li>".$key_value." : ".$rslt."</li>";
}
$str_div.="</ul>";
$str_div.="</div>";
}
?>
<p>Choisissez un client: </p>
<select id='select' name='select' onchange='affiche()'>
<option value='0'>-----choisir-----</option>
<?php
echo $str;
?>
</select>
<?php
echo $str_div;
?> |
merci d'avance
Partager