<div id="menu_left_haut_ges"><h3>Les doublons</h3></div>
<div id="menu_leftbk">
<form method="POST" action="index.php?page=participants_doublons">
<select size="1" name="nom">
<?php
include("../inscriptions/connexion.php"); // connexion bd
// requête pour trouver les doublons dans la table participants
$res=$conn->query("SELECT DISTINCT participants.nom,participants.prenom
FROM participants
INNER JOIN
(SELECT participants.nom, participants.prenom
FROM participants
GROUP BY participants.nom, participants.prenom
HAVING COUNT(*) > 1
)Tmp
ON participants.nom=Tmp.nom AND participants.prenom=Tmp.prenom
ORDER BY participants.nom, participants.prenom");
$tab=mysqli_fetch_array($res);
$lignes=mysqli_affected_rows($conn); // nombre de doublons trouvés
$row_cnt = mysqli_num_rows($result);
for ($i=0;$i<$lignes;$i++) // si doublons alors création ligne dans liste déroulante
{
?><option><?php echo $tab["nom"]."-".$tab["prenom"];?></option><?php
$tab=mysqli_fetch_array($res);
}
mysqli_close($conn); // Déconnexion de MySQL
?>
</select>
<?php
if ($lignes > 0)
{ // affichage bouton pour aller vers page participants_doublons.php
?>
<input class="bouton" type="submit" value="Ok" name="B1"></form>
<?php echo "<h2 class=rouge>$lignes doublon(s)<h2>";
}
else
{
?></form><br>
<h2 class="vert">Pas de doublon trouvé</h2>
<?php
}
?>
</div>
<div id="menu_left_bas"></div>
Il s'agit de vérifier les doublons dans la table des participants et, si il y a des doublons, d'alimenter une liste déroulante et ensuite afficher un bouton pour aller vers un autre script de gestion des doublons.Warning: Undefined variable $result in /customers/6/7/6/educationetfamille.be/httpd.www/em/menus/menu_doublons.php on line 22
Fatal error: Uncaught TypeError: mysqli_num_rows(): Argument #1 ($result) must be of type mysqli_result, null given in /customers/6/7/6/educationetfamille.be/httpd.www/em/menus/menu_doublons.php:22
Stack trace:
#0 /customers/6/7/6/educationetfamille.be/httpd.www/em/menus/menu_doublons.php(22): mysqli_num_rows(NULL)
#1 /customers/6/7/6/educationetfamille.be/httpd.www/em/inscriptions/index.php(59): include('/customers/6/7/...')
#2 {main}
thrown in /customers/6/7/6/educationetfamille.be/httpd.www/em/menus/menu_doublons.php on line 22
Qu'en pensez-vous ?