salut . j'ai une base de donnée que j'ai nommée autoecole et deux tables candidat et payement .
je veux afficher des information issu des deux tables partir du champs Ncandidat (qui se trouve dans les tables) .
je viens a vous pour avoir de l'aide .
voici le code que j'ai tenté mais qui n'affiche rien .
<?php
if(isset($_POST['Ncandidat']) && !empty($_POST['Ncandidat'])){
include("connection.php");
$id=(int)$_POST['Ncandidat'];
$id=mysql_real_escape_string($id);
$sql = "SELECT DISTINCT Ncandidat,nom,pieceP,contact,nationalite FROM candidat where Ncandidat='".$id."'";
$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
}
?>
<!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>
<style type="text/css">
<!--
.Style3 {color: #FFFFFF}
.Style11 {color: #0000FF; font-weight: bold; }
.Style14 {color: #990000}
.Style16 {
color: #000000;
font-weight: bold;
}
.Style17 {font-weight: bold}
-->
</style>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<p> </p>
<table width="333" border="0" align="center" background="images/Untitled-31.jpg" bgcolor="#FFFFCC">
<tr>
<td bgcolor="#0000FF"><A HREF="bienvenue.php" TITLE="click pour enregistrer vos enfants!!! !!!!" class="Style17 Style3"><strong>Accueil</strong></a></td>
<td bgcolor="#0000FF"> </td>
</tr>
<tr>
<td width="195"><span class="Style16">Numero du Candidat
</span>
<input type="text" name="questionnaire" /></td>
<td width="128"><input type="submit" name="Submit" value="RECHERCHER" /></td>
</tr>
</table>
</form>
<table width="1306" height="591" border="0" align="center" bgcolor="#FFFFFF">
<tr>
<td width="304"> </td>
<td width="672" rowspan="3"><center>
<fieldset style="width: 650px;" >
<legend><span class="Style11">RENSEIGNEMENT SUR LE CANDIDAT</span></legend>
<table width="637" border="0" align="center" cellspacing="1" bordercolor="#333333" bgcolor="#FFFFCC">
<tr bgcolor="#999999">
<th bgcolor="#FFFFCC" scope="row"><div align="left"></div></th>
<td width="188" bgcolor="#FFFFCC"><div align="right"></div></td>
</tr>
<tr bgcolor="#999999">
<th width="146" bgcolor="#FFFFCC" scope="row"><span class="Style14">NOM ET PRENOMS </span></th>
<th width="188" bgcolor="#FFFFCC" scope="row"><span class="Style14">NUMERO DE LA PIECE </span></th>
<th width="144" bgcolor="#FFFFCC" scope="row"><span class="Style14">CONTACT </span></th>
<th width="146" bgcolor="#FFFFCC" scope="row"><span class="Style14">NATIONALITEL </span></th>
</tr>
<?php
while ($liste_etu=mysql_fetch_assoc($req)) {
$j=$i%2;
?>
<tr bgcolor=#FFFFCC>
<td bgcolor="#CCCCCC"><input type="text" name="textfield" value="<?php echo $liste_etu['nom'] ?>"/></td>
<td bgcolor="#CCCCCC"><input type="text" name="textfield" value="<?php echo $liste_etu['pieceP'] ?>"/></td>
<td bgcolor="#CCCCCC"><input type="text" name="textfield" value="<?php echo $liste_etu['contact'] ?>"/></td>
<td bgcolor="#CCCCCC"><input type="text" name="textfield" value="<?php echo $liste_etu['nationalite'] ?>"/></td>
</tr>
<?php
}
?>
</table>
</fieldset>
</center>
</p><center>
<fieldset style="width: 650px;" ><legend><span class="Style11">PAYEMENT</span></legend>
<table width="585" border="0" align="center" cellspacing="1" bordercolor="#333333" bgcolor="#FFFFCC">
<tr bgcolor="#999999">
<th bgcolor="#FFFFCC" scope="row"><div align="left"></div></th>
<td width="203" bgcolor="#FFFFCC"><div align="right"></div></td>
</tr>
<tr bgcolor="#999999">
<th width="228" bgcolor="#FFFFCC" scope="row"><span class="Style14">NUMERO DE PAYEMENT</span></th>
<th width="203" bgcolor="#FFFFCC" scope="row"><span class="Style14">DATE DE PAEYEMENT</span></th>
<th width="144" bgcolor="#FFFFCC" scope="row"><span class="Style14">MTV</span></th>
</tr>
<?php
if(isset($_POST['Ncandidat']) && !empty($_POST['Ncandidat'])){
include("connection.php");
$id=(int)$_POST['Ncandidat'];
$id=mysql_real_escape_string($id);
// if($req){
$id1=(int)$_POST['id_P'];
$id1=mysql_real_escape_string($id1);
$sql = "SELECT * FROM payement WHERE id_P='".$id."' ";
$req = mysql_query($sql) or die(a.'Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
while ($liste_etu=mysql_fetch_assoc($req)) {
$j=$i%2;
?>
<tr bgcolor=#FFFFCC>
<td bgcolor="#CCCCCC"><input type="text" name="textfield" value="<?php echo $liste_etu['Npayement'] ?>"/></td>
<td bgcolor="#CCCCCC"><input type="text" name="textfield" value="<?php echo $liste_etu['datePay'] ?>"/></td>
<td bgcolor="#CCCCCC"><input type="text" name="textfield" value="<?php echo $liste_etu['MTV'] ?>"/></td>
</tr>
<?php
// }
}
}
?>
</table>
</fieldset>
</center></td>
<td width="316"> </td>
</tr>
<tr>
<td height="225"> </td>
<td width="316"> </td>
</tr>
<tr>
<td> </td>
<td width="316"> </td>
</tr>
</table>
</body>
</html>
Afficher la suite