créer un champs à partir d'une req sql
Bonjour,
je veux que les résultats d'une requete sql placent dans les titres d'un tableau voila le code:
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 40 41 42
|
<table border="2" id="tab">
<tr class="ligne">
<th>Num</th>
<th>Nom</th>
<th>Prenom</th>
<?php
mysql_connect("localhost","root","123") or die(mysql_error());
mysql_select_db("basepfe")or die('Pas de Base de donn\351');
$sql1= mysql_query("(SELECT t.TYPE FROM TYPE AS t, la3ba AS l, smodule AS s WHERE t.idT = 'l.idT' AND l.idS ='s.idS' AND s.nomS ='ana')");
while($result=mysql_fetch_array($sql1))
{
$type1 = $result['type'];
}
?>
<th><?php echo $type1; ?></th>
</tr>
<?php
mysql_connect("localhost","root","123") or die(mysql_error());
mysql_select_db("basepfe")or die('Pas de Base de donn\351');
$sql= mysql_query("select * from etudiant");
while($result=mysql_fetch_array($sql))
{
$num = $result['num'];
$nom = $result['nomE'];
$prenom = $result['prenom'];
?>
<tr>
<th><?php echo $num; ?></th>
<th><?php echo $nom; ?></th>
<th><?php echo $prenom; ?></th>
</tr>
<?php }
echo "<script> location.reload(); <script> "?>
</table> |
voila le résultat qui s'affiche:
Pièce jointe 146262
moi je veux que le résultat affiché du req s'ajoute comme nom, num prenom
pouvez-vous m'aider svp? merci d'avance