Page 1 sur 1

problème d'affiche de table d'une base de données

Posté : 20 mars 2014, 09:34
par leandro
j'ai écris un code pour afficher une table de ma base de données. mais pas de message d'erreur et rien ne s'affiche dans la table
Voici mon code entier :
<?php
//session_start();
mysql_connect ("localhost", "root", ""); // connexion a la base
mysql_select_db ("vision"); // Sélection de la base de données utilisée.
?>
<!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=utf-8" />
<title>New_schools</title>

<?php include("style.php"); //inclusion of the CSS style's file

?>
</head>

<body>
<div id="main">
<img src="images/logo.jpg" class="img" alt="" />
<center>
<h1>BIENVENUE SUR LA PLATE-FORME DE GROUPE VISION</h1>
<h2>Inscription de membres</h2>
</center>
<br /><br /><br /><br />

<?php
$datejour=date("d-m-Y");
echo 'Nous sommes le ' .$datejour;
include("./navigation2.php"); // incluision of the navigation file
//$data = mysql_query("SELECT * FROM membre ");
?>
<br />

<a href ="deconnexion.php" onclick="return confirm('Voulez vous vraiment supprimer ce membre?');" >Déconnexion</a>
<form action="inscription.php" method="">
<fieldset>
<legend>LISTE DES MEMBRES</legend>
<table align="center" style="border-collapse:collapse; border-color:#666666; border-width: thick; border-style:ridge;">
<tr>
<th style="border-color:#666666; border-width: thick; border-style:ridge;">Numero</th>
<th style="border-color:#666666; border-width: thick; border-style:ridge;">Departement</th>
<th style="border-color:#666666; border-width: thick; border-style:ridge;">Commune</th>
<th style="border-color:#666666; border-width: thick; border-style:ridge;">Arrondissemnt</th>
<th style="border-color:#666666; border-width: thick; border-style:ridge;">Village</th>
<th style="border-color:#666666; border-width: thick; border-style:ridge;">nom</th>
<th style="border-color:#666666; border-width: thick; border-style:ridge;">prenom</th>
<th style="border-color:#666666; border-width: thick; border-style:ridge;">Datenaiss</th>
<th style="border-color:#666666; border-width: thick; border-style:ridge;">Lieunaiss</th>
<th style="border-color:#666666; border-width: thick; border-style:ridge;">Communepro</th>
<th style="border-color:#666666; border-width: thick; border-style:ridge;">Telephone</th>
<th style="border-color:#666666; border-width: thick; border-style:ridge;">Email</th>
<th style="border-color:#666666; border-width: thick; border-style:ridge;">Sexe</th>
<th style="border-color:#666666; border-width: thick; border-style:ridge;">Situation</th>
<th style="border-color:#666666; border-width: thick; border-style:ridge;">Qualite</th>
<th style="border-color:#666666; border-width: thick; border-style:ridge;">Profession</th>
<th style="border-color:#666666; border-width: thick; border-style:ridge;">Niveau</th>
<th style="border-color:#666666; border-width: thick; border-style:ridge;">Dateadhe</th>
<th style="border-color:#666666; border-width: thick; border-style:ridge;">Avis</th>
<th style="border-color:#666666; border-width: thick; border-style:ridge;">Suppression</th>
<th style="border-color:#666666; border-width: thick; border-style:ridge;">Modification</th>
</tr>
<?php
$sql = mysql_query("SELECT * from membre ");
while($membre = mysql_fetch_array($sql) );//on fait une boucle pour afficher tous les adhérents
{ ?>
<tr>
<td style="border-color:#666666; border-width: thick; border-style:ridge;"><?php echo $membre['numero']; ?></td>
<td style="border-color:#666666; border-width: thick; border-style:ridge;"><?php echo $membre['dep']; ?></td>
<td style="border-color:#666666; border-width: thick; border-style:ridge;"><?php echo $membre['com']; ?></td>
<td style="border-color:#666666; border-width: thick; border-style:ridge;"><?php echo $membre['arond']; ?></td>
<td style="border-color:#666666; border-width: thick; border-style:ridge;"><?php echo $membre['vil']; ?></td>
<td style="border-color:#666666; border-width: thick; border-style:ridge;"><?php echo $membre['nom']; ?></td>
<td style="border-color:#666666; border-width: thick; border-style:ridge;"><?php echo $membre['pren']; ?></td>
<td style="border-color:#666666; border-width: thick; border-style:ridge;"><?php echo $membre['datenaiss']; ?></td>
<td style="border-color:#666666; border-width: thick; border-style:ridge;"><?php echo $membre['lieunaiss']; ?></td>
<td style="border-color:#666666; border-width: thick; border-style:ridge;"><?php echo $membre['compro']; ?></td>
<td style="border-color:#666666; border-width: thick; border-style:ridge;"><?php echo $membre['tel']; ?></td>
<td style="border-color:#666666; border-width: thick; border-style:ridge;"><?php echo $membre['mail']; ?></td>
<td style="border-color:#666666; border-width: thick; border-style:ridge;"><?php echo $membre['sexe']; ?></td>
<td style="border-color:#666666; border-width: thick; border-style:ridge;"><?php echo $membre['situa']; ?></td>
<td style="border-color:#666666; border-width: thick; border-style:ridge;"><?php echo $membre['qual']; ?></td>
<td style="border-color:#666666; border-width: thick; border-style:ridge;"><?php echo $membre['prof']; ?></td>
<td style="border-color:#666666; border-width: thick; border-style:ridge;"><?php echo $membre['niv']; ?></td>
<td style="border-color:#666666; border-width: thick; border-style:ridge;"><?php echo $membre['dateadh']; ?></td>
<td style="border-color:#666666; border-width: thick; border-style:ridge;"><?php echo $membre['avis']; ?></td>
<td style="border-collapse:collapse; border-color:#666666; border-width: thick; border-style:ridge;"><a href="supr_membre.php?pseudo=<?php echo $membre['numero'] ?>" onclick="return confirm('Voulez vous vraiment supprimer <?php echo $membre['numero'] ?> ?');" > SUPPRIMER </a></td>
<td style="border-collapse:collapse; border-color:#666666; border-width: thick; border-style:ridge;"><a href="modif2.php?pseudo=<?php echo $membre['numero']; ?>" onclick="return confirm('Voulez vous vraiment modifier <?php echo $membre['numero'] ?> ?');" > &Eacute;DITER </a></td>

</tr>
<?php
}
// on ferme la connexion à mysql
//mysql_close();
$_SESSION['lieu'] = "public";
?>
<tr>
<td colspan="25" align="center" style="border-color:#666666; border-width: thick; border-style:ridge;"><input type="submit" value="Enrégistrer un autre" /></td>
</tr>
</table>
</fieldset>
</form>
</div>
</body>
</html>

Re: problème d'affiche de table d'une base de données

Posté : 20 mars 2014, 21:10
par Pepsi33
Il y a peut-être un problème de connexion à la BDD ou de sélection de la table.

Tu peux essayer ça:
mysql_connect ("localhost", "root", "") or die(mysql_error());
mysql_select_db ("vision") or die(mysql_error());

Au moins tu seras sûr qu'il n'y a pas de problème à ce niveau là.

Re: problème d'affiche de table d'une base de données

Posté : 21 mars 2014, 16:53
par leandro
Oui je l'ai essaye comme vous l'avez suggérer mais le problème demeure
Mais est ce qu'un conflit de type de variable dans la base de données peut il être à la base si oui comment faire?