Accueil > Forum > > > > problème de requète pour afficher des informations sur les enregistrés
problème de requète pour afficher des informations sur les enregistrés
lundi 9 janvier 2012 à 09:19:54 |
problème de requète pour afficher des informations sur les enregistrés

msi079
|
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 .
Code PHP :
<?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>
|
|
lundi 9 janvier 2012 à 09:55:51 |
Re : problème de requète pour afficher des informations sur les enregistrés

cod57
|
bonjour
tu devrais utiliser join
petit ex de base ici
pourquoi deux fois ce test ?
if(isset($_POST['Ncandidat']) && !empty($_POST['Ncandidat'])){
...
 Bonne programmation !
|
|
lundi 9 janvier 2012 à 12:27:16 |
Re : problème de requète pour afficher des informations sur les enregistrés
|
lundi 9 janvier 2012 à 12:31:32 |
Re : problème de requète pour afficher des informations sur les enregistrés

msi079
|
j'ai mis en commentaire :
mais ça n'affiche toujours rien :
//if(isset($_POST['Ncandidat']) && !empty($_POST['Ncandidat'])){
voici le code rectifié:
Code PHP :
<?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>
|
|
lundi 9 janvier 2012 à 13:20:15 |
Re : problème de requète pour afficher des informations sur les enregistrés

cod57
|
peux tu me donner un bout deux tes deux tables s.t.p.
structures ... et une ligne
je vais voir après
 Bonne programmation !
|
|
lundi 9 janvier 2012 à 13:29:13 |
Re : problème de requète pour afficher des informations sur les enregistrés

msi079
|
quand j’exécute j'obtient cette erreur :
Notice: Undefined variable: req in C:\wamp\www\POJET AUTO ECOLE\recherche3.php on line 72
Warning: mysql_fetch_assoc() expects parameter 1 to be resource, null given in C:\wamp\www\POJET AUTO ECOLE\recherche3.php on line 72.
en utilisant les jointure voici ce que j'ai fait :
Code PHP :
<?php
if(isset($_POST['Ncandidat']) && !empty($_POST['Ncandidat'])){
include("connection.php");
$id=(int)$_POST['Ncandidat'];
$id=mysql_real_escape_string($id);
$sql = "SELECT DISTINCT a.Ncandidat,a.nom,a.pieceP,a.contact,a.nationalite,b.Npayement,b.datePay,b.MTV FROM candidat a, renseigner b 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>
<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
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>
<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 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>
|
|
lundi 9 janvier 2012 à 13:46:12 |
Re : problème de requète pour afficher des informations sur les enregistrés

msi079
|
voici la structure de mes tables et des contenues :
-- Structure de la table `candidat`
--
CREATE TABLE IF NOT EXISTS `candidat` (
`id_c` int(15) NOT NULL AUTO_INCREMENT,
`Ncandidat` int(15) NOT NULL,
`nom` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
`jourD` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
`moisD` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
`anneeD` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
`lieuP` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
`nomP` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`nomM` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`pieceP` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`contact` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
`nationalite` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
`Ndossier` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
`categorieP` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
`montantT` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id_c`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=4 ;
--
-- Contenu de la table `candidat`
--
INSERT INTO `candidat` (`id_c`, `Ncandidat`, `nom`, `jourD`, `moisD`, `anneeD`, `lieuP`, `nomP`, `nomM`, `pieceP`, `contact`, `nationalite`, `Ndossier`, `categorieP`, `montantT`) VALUES
(1, 10001, 'coulibaly zana souleymane', '3', '3', '1979', 'lakota', 'coulibaly T', 'minata Koné', 'c10024582', '01789050', 'ivoirienne', '100001', 'BCDE', '120 000f'),
(2, 10002, 'KESSE LUDVINE', '6', '7', '1983', 'bonoua', 'coulibaly T', 'minata Koné', 'c1002458200', '01789050', 'ivoirienne', '100002', 'B', '105 000f'),
(3, 10003, 'KONE CHANTAL', '25', '5', '1982', 'dabou', 'coulibaly T', 'minata Koné', 'c10024582458', '01789053', 'ivoirienne', '100003', 'C', '150 000f');
-- --------------------------------------------------------
--
-- Structure de la table `payement`
--
CREATE TABLE IF NOT EXISTS `payement` (
`id_P` int(15) NOT NULL AUTO_INCREMENT,
`Ncandidat` int(15) NOT NULL,
`Npayement` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`datePay` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`MTV` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id_P`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=4 ;
--
-- Contenu de la table `payement`
--
INSERT INTO `payement` (`id_P`, `Ncandidat`, `Npayement`, `datePay`, `MTV`) VALUES
(1, 0, '1001', '07-01-2012', '100 000F'),
(2, 10002, '1002', '07-01-2012', '80 000F'),
(3, 10003, '1003', '07-01-2012', '80 000F');
|
|
lundi 9 janvier 2012 à 15:10:57 |
Re : problème de requète pour afficher des informations sur les enregistrés

Lyle56
|
Bonjour,
Au premier coup d'oeil je te dirai qu'il te manque une petite chose :
Un Index !!
CREATE TABLE IF NOT EXISTS `payement` (
`id_P` int(15) NOT NULL AUTO_INCREMENT,
`Ncandidat` int(15) NOT NULL,
`Npayement` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`datePay` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`MTV` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id_P`)
CREATE INDEX Nom_Index ON candidat(`Ncandidat`)
) ENGINE
Ta requéte est ensuite simplifié pour ton cas:
Select [p.*, c.* ,..les champs que tu veut] FROM payement p, candidat c NATURAL JOIN
Ta jointure va se faire sur les index définis dans ta table.
Aprés il faut faire attention avec ta boucle de traitement de résultats, pour le cas ou tu ne retournerai aucun enregistrement (ce qui est le cas avec l'erreur que tu as)
Sans maitrise, la puissance n'est rien
Il ne faut pas vendre la peau de l'ours, non il ne faut pas.
|
|
lundi 9 janvier 2012 à 15:33:45 |
Re : problème de requète pour afficher des informations sur les enregistrés

cod57
|
Code PHP :
<?php
print_r($_POST);
if(isset($_POST['Ncandidat']) && !empty($_POST['Ncandidat'])){
include("config/config.php");
echo $id=(int)$_POST['Ncandidat'];
$id=mysql_real_escape_string($id);
$sql = "SELECT DISTINCT candidat.Ncandidat,candidat.nom,candidat.pieceP,candidat.contact,candidat.nationalite,payement.Npayement,payement.datePay,payement.MTV
FROM candidat,payement
where candidat.Ncandidat = payement.Ncandidat and candidat.Ncandidat='".$id."'";
/*
$query = "SELECT candidat.Ncandidat,candidat.nom,candidat.pieceP,candidat.contact,candidat.nationalite,payement.Npayement,payement.datePay,payement.MTV ".
"FROM candidat, payement ".
"WHERE candidat.Ncandidat = payement.Ncandidat"; */
$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
$res=null;
while ($liste_etu=mysql_fetch_assoc($req)) {
//$j=$i%2;
$res.='<tr bgcolor=#FFFFCC>
<td bgcolor="#CCCCCC"><input type="text" name="textfield" value="'. $liste_etu['nom'] .'"/></td>
<td bgcolor="#CCCCCC"><input type="text" name="textfield" value="'. $liste_etu['pieceP'] .'"/></td>
<td bgcolor="#CCCCCC"><input type="text" name="textfield" value="'. $liste_etu['contact'] .'"/></td>
<td bgcolor="#CCCCCC"><input type="text" name="textfield" value="'. $liste_etu['nationalite'] .'"/></td>
<td bgcolor="#CCCCCC"><input type="text" name="textfield" value="'. $liste_etu['Npayement'] .'"/></td>
<td bgcolor="#CCCCCC"><input type="text" name="textfield" value="'. $liste_etu['datePay'] .'"/></td>
<td bgcolor="#CCCCCC"><input type="text" name="textfield" value="'. $liste_etu['MTV'] .'"/></td>
</tr>';
}
}else{
$res=null;
}
?>
<!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="Ncandidat" /></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>
<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
echo $res = isset($res) ? $res : null;
?>
</table>
</fieldset>
</center>
<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>
config/config.php
Code PHP :
<?php
/******************************************************************************/
function nettoieProtect(){
foreach($_POST as $k => $v){
$v=mysql_real_escape_string(strip_tags(trim($v)));
$_POST[$k]=$v;
}
foreach($_GET as $k => $v){
$v=mysql_real_escape_string(strip_tags(trim($v)));
$_GET[$k]=$v;
}
foreach($_REQUEST as $k => $v){
$v=mysql_real_escape_string(strip_tags(trim($v)));
$_REQUEST[$k]=$v;
}
}
/******************************************************************************/
$dbhost='localhost';/*adresse du serveur de la base de donnée*/
$dbuser='root';/*identifiant personnel à la base de donnée*/
$dbpass='';/*mot de passe pour y accéder*/
$db='amsi';/*nom de la base*/
$table='comptes_utilisateurs';
/*connexion au serveur*/
@mysql_connect($dbhost,$dbuser,$dbpass);
@mysql_select_db($db);
/*protection de la base*/
nettoieProtect();
?>
j'ai testé comme ça sur mon wamp
c'est bon
++
 Bonne programmation !
|
|
lundi 9 janvier 2012 à 15:59:13 |
Re : problème de requète pour afficher des informations sur les enregistrés

msi079
|
salut merci de bien vouloir m'aider j'étais allé manger un peu .
. je viens d’exécuter la solution que tu a proposé .
voici l'erreur qui s'affiche :
Array ( [Ncandidat] => 10003 [Submit] => RECHERCHER ) 10003Erreur SQL !
SELECT DISTINCT candidat.Ncandidat,candidat.nom,candidat.pieceP,candidat.contact,candidat.nationalite,payement.Npayement,payement.datePay,payement.MTV FROM candidat,payement where candidat.Ncandidat = payement.Ncandidat and candidat.Ncandidat=''
Access denied for user 'Système'@'localhost' (using password: NO)
|
|
Cette discussion est classée dans : code, afficher, tables, payement, candidat
Répondre à ce message
Sujets en rapport avec ce message
Contenu de la base mysql [ par bonjovi51 ]
S@lut Ô programmeurs, j'ai besoin de votre aide. J'aimerai savoir si il est de possible d'afficher les tables de ma base mysql (et non pas le contenu
Afficher du code dans une page [ par VooDooS ]
Bonjour !Voila, je voudrais savoir comment faire pour afficher dans une page php, du code php pour que l'on puisse le lire, sans quil soit interprété.
afficher les trois derniers enregistrements [ par daveda ]
salut,comment afficher les trois derniers enregistrements (les trois dernières lignes de mes tables)sachant que pour chaques tables j'ai pour clé pri
Afficher image variable [ par Desperados21 ]
Bonjour a tous... Je debute dans le php et j'ai un petit probleme pour affic
Creation dynamique d'une page, puis l'afficher dans une frame [ par marcus671 ]
Voila, j'ai une page coupé en 2 cadres, framebas et framehaut.Dans framehaut, j'ai repris un code pour afficher un calendrier et dans frame bas, j'ai
Payement par internet [ par zakichane ]
Bonjour, je veux créer une page web avec php qui permet de verifier le code et le mot de passe du carte visa ou uelque chose comme ça alors que doi je
code pour afficher le staff [ par sitemo ]
bonjour je suis novice j'utilise php je cherche ou quelquun peut maide afin d'afficher le staff sur mon site comment je pourrai proceder svp merci MK
Ne pas traiter le code html [ par Tit0x ]
hello Dans ma BDD, j'ai un champs qui contient du code html. J'aimerais pouvoir l'afficher sans que php tienne compte de l'html (donc j'aimerais affi
Afficher une erreur si ... [ par christobal ]
Bonjour,J'utilise le code suivant pour supprimer plusieurs lignes dans ma db.Je choisi les lignes en cochant une case dans un page qui liste mes "menu
Intranet PHP/MySql (suite site web dynamique!) [ par sagesse ]
Bonjour, je n'arrive pas à enregistrer les données saisies ds mon formulaire ds ma base de données mysql. (j utilise easyphp).j'ai ce message d erreur
Livres en rapport
|
Derniers Blogs
ROSLYN FLUENT APIS: ROSLYNHELPER NUGET PACKAGEROSLYN FLUENT APIS: ROSLYNHELPER NUGET PACKAGE par Matthieu MEZIL
Si vous utilisez Roslyn et que vous vous voulez vous simplifier le code du code rewriter, je vous conseille d'installer mon NuGet package RoslynHelper ....(read more) ...
Cliquez pour lire la suite de l'article par Matthieu MEZIL POUR RAPPEL ! LES SPéCIFICATIONS DES PROTOCOLES OFFICE ET SHAREPOINT SONT DISPONIBLES SUR MSDNPOUR RAPPEL ! LES SPéCIFICATIONS DES PROTOCOLES OFFICE ET SHAREPOINT SONT DISPONIBLES SUR MSDN par neodante
Quelle est le point commun entre : Microsoft il y a 10 ans et Apple aujourd'hui ? Réponse: avoir une politique de protocoles propriétaires et fermés :) Car pour rappel (si si je vous assure c'est important de le rappeler), la majorité des spécifications e...
Cliquez pour lire la suite de l'article par neodante JOYEUX ANNIVERSAIRE NIXJOYEUX ANNIVERSAIRE NIX par ebartsoft
Souhaitons un bon et joyeux anniversaire à notre hôte à tous, Nix.
Je ne le répéterais jamais assez mais sans lui rien ne serait possible. Il défit en permanence les lois de la gravité et comme il le dit si bien, si tu lui fais confiance ça devra...
Cliquez pour lire la suite de l'article par ebartsoft IMAGINE CUP 2012, MAKE A SIGN EN FINALEIMAGINE CUP 2012, MAKE A SIGN EN FINALE par junarnoalg
Voilà qui est fait, la nouvelle est officielle ! L'équipe belge "Make a Sign" va au pays des kangourous défendre son projet dans la catégorie Software Design. http://www.imaginecup.com/CompetitionsContent/Competition/WorldwideFinalists.aspx V...
Cliquez pour lire la suite de l'article par junarnoalg KINECT 1.5 IS OUT !KINECT 1.5 IS OUT ! par Vko
La version 1.5 du Kinect For Microsoft vient tout juste de sortir ! Plein de nouveautés: Tracking de squelette en Near Mode Détection en position assise Détection faciale avec un SDK dédié Documentation et des guideline (enfin) Un out...
Cliquez pour lire la suite de l'article par Vko
Logiciels
sDEVIS-FACTURES vlPRO (8.1.0.3)SDEVIS-FACTURES VLPRO (8.1.0.3)sDEVIS-FACTURES vlPRO a été mis au point pour les particuliers, créateurs, entrepreneurs, artisa... Cliquez pour télécharger sDEVIS-FACTURES vlPRO 974 Application Server (12.2.4.6)974 APPLICATION SERVER (12.2.4.6)Développez de puissantes applications dans un environnement de 'cloud computing', clusterisé, séc... Cliquez pour télécharger 974 Application Server vPicture (1.4.2.1)VPICTURE (1.4.2.1)Avec vPicture, hébergez vos images facilement et rapidement.
vPicture est un utilitaire simple, ... Cliquez pour télécharger vPicture Easy-Planning (2.2.1.6)EASY-PLANNING (2.2.1.6)Easy-Planning permet de créer des plannings sous la représentation de diagrammes et est adapté au... Cliquez pour télécharger Easy-Planning COM-BACKUP (2.0)COM-BACKUP (2.0)
COM-BACKUP est un logiciel de sauvegarde qui permet de planifier les sauvegardes de vos dossiers ...
Cliquez pour télécharger COM-BACKUP
|