En combinant mes different code j ai souhaiter afficher dans un tableau une liste de personne en fonction d' un idenfiant recuperer dans une liste deroulante mais j ai deux question .
voila mon code d abord
Code : Tout sélectionner
<?php
include("connexion.inc.php");
$sql = 'SELECT * FROM ville order by id_ville;';
$result = pg_query($sql) or die( 'Erreur' );
$nb = pg_num_rows($result);
echo '<h1> nombre '.$nb.'</h1>';
//echo '<select name="ville">';
echo "<select name=\"ville\" onChange=\"location.href='" . $_SERVER['PHP_SELF'] . "?idVille=' + this.value\">";
if ( $nb==0 ) {
echo '<option>Aucune ville</option>';
} else {
echo '<option>Ville</option>';
while ( $list = pg_fetch_array( $result ) ) {
echo '<option value="'.$list['id_ville'].'">'.$list['nom_ville'].'</option>';
}
}
echo '</select> ';
$idville=@$_GET['idVille'];
//affichage du tableau
$sql='select * from personne where ville='.$idville.' order by nom_perso';
$result=pg_query($sql);
echo '<table width="80%" border="1" bgcolor="silver">';
while($list=pg_fetch_array($result))
echo '<tr onmouseover="this.style.backgroundColor=\'yellow\'" onmouseout="this.style.backgroundColor=\'silver\'" style="background-color: silver"><td>'.$list['id_perso'].'</td><td>'.$list['nom_perso'].'</td><td>'.$list['prenom_perso'].'</td><td>'.$list['ville'].'</td></tr>';
echo '</table>';
?>et je voulais savoir si je pouvais en cliquant sur une ligne du tableau afficher une nouvelle page au format reduit qui serait en faite un formulaire contenant les données presente sur la ligne que j ai cliqué.Warning: pg_query(): Query failed: ERROR: syntax error at or near "order" at character 37 in c:\documents and settings\franky\bureau\avion\affichagetableau.php on line 33
Warning: pg_fetch_array(): supplied argument is not a valid PostgreSQL result resource in c:\documents and settings\franky\bureau\avion\affichagetableau.php on line 35
Est ce possible ??