Affichage sans redondance php mysql

Fermé
HamadaN2A Messages postés 2 Date d'inscription mercredi 18 mai 2016 Statut Membre Dernière intervention 19 mai 2016 - 18 mai 2016 à 17:11
HamadaN2A Messages postés 2 Date d'inscription mercredi 18 mai 2016 Statut Membre Dernière intervention 19 mai 2016 - 19 mai 2016 à 02:15
Hello world ,
j'ai un probleme d'affichage ,
j'ai deux tables offres et cv liés
je voudrais afficher les CV qui ont postulé pour chaque offre en évitant la redondance



<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="styleoffrepostuler.css" rel="stylesheet" media="all" type="text/css">
<title>H2S BC - Espace candidat </title>
</head>
<body>

<div id="blackbarre">
</div>
<div id='cssmenu' align=center>
<ul>
<li><a href='first.php'>Accueil</a></li>
<li><a href='qsn.php'>Qui sommes nous ? </a></li>
<li><a href='#'>Offres</a></li>
<li><a href='contact.htm'>Contactez nous</a></li>
<li><a href='offrespostuler'>Nous offres</a></li>
<li><a href='logout.php'>Déconnexion</a></li>
</ul>
</div>
<h2> liste des offres :</h2>

<?php
ini_set('display_errors','off');
session_start();
$conn=mysql_connect("localhost","root","") or die (mysql_error());
mysql_select_db("h2s",$conn) or die (mysql_error());
mysql_query ('SET NAMES UTF8');
$titre=$_GET['TITRE'];
$req2="SELECT * FROM offres a, recruteurs b WHERE a.IDOFFRE = b.IDOFFRE AND TITRE='$titre'";
$rs2=mysql_query($req2) or die(mysql_error());
?>
<?php while($titre=mysql_fetch_assoc($rs2)) { ?>

<tr>
<hr width="40%" size="1" color="white"></td></br>
<div class="tete"><p style="font-size:20px;color:white;"><?php echo ($titre['NOMENTREPRISE']) ?></p>
<img src="<?php echo ($titre['LOGO']) ?>"width="60"height="60"></br>
</div>
<?php } ?>
<div align="center">
<form name="f1"method="POST"action="">
<table align="center" width=1000px>

<?php
$req="SELECT DISTINCT CV,TITRE FROM cv a, offres b WHERE a.IDOFFRE = b.IDOFFRE ";
$rs=mysql_query($req) or die(mysql_error());
?>
<?php while($row=mysql_fetch_assoc($rs)) {

?>
<tr>


<tr><td><?php echo ($row ['TITRE']) ?></td></tr>

<tr>
<TD>CV :</TD>
<td>
<a href="<?php echo($row['CV']) ?>"
download="<?php echo($row['CV']) ?>"><img src="pdf.png" width="60px" height="70px"/></a>
</td>
</tr>
</td></br>


</tr>

<?php } ?>
</table>
</form>
</body>
</html>

A voir également:

1 réponse

jordane45 Messages postés 38144 Date d'inscription mercredi 22 octobre 2003 Statut Modérateur Dernière intervention 21 avril 2024 4 650
18 mai 2016 à 19:26
Bonjour,

Déjà commence par changer d'extension mysql.
https://www.commentcamarche.net/faq/43261-php-l-extension-mysql-est-obsolete#top

Ensuite... que veux tu dire exactement par redondance ?
Tu veux afficher, pour chaque offre les CV qui ont postulés ou tu veux afficher les CV qui ont postulés à chaque offre ? (ce n'est pas très clair).

0
HamadaN2A Messages postés 2 Date d'inscription mercredi 18 mai 2016 Statut Membre Dernière intervention 19 mai 2016
19 mai 2016 à 02:15
je voudrais afficher chaque offres avec les CV qui ont postulé , comme dans l'imprimé ecran sans repeter le titre des offres , par exemple l'offre: dev web a 2 CV , je voudrais les afficher sous l'offre sans repeter dev web a chaque fois

est ce assez claire ?
0