TYBMHI Posted October 1, 2022 Share Posted October 1, 2022 Bonjour à tous, Je voudrais savoir comment m'y prendre pour faire plus simple. En effet, j'ai environ 300 mails et j'imagine qu'il y a beaucoup plus simple que de faire ce que je fais trois cents fois . <?php $pre_classement_mail = "SELECT mail FROM membre"; $connect_classement_mail = $connect->query($pre_classement_mail); while ($classement_mail = mysqli_fetch_array($connect_classement_mail)) { $mail[] = $classement_mail['mail']; } $liste_mail = $mail[0].','.$mail[1].','.$mail[2].','.$mail[3].','.$mail[4].','.$mail[5].','.$mail[6].','.$mail[7]; ?>  Je vous en remercie d'avance. Link to comment Share on other sites More sharing options...
Solution BlackPage Posted October 2, 2022 Solution Share Posted October 2, 2022 Salut, si tu fais une concaténation en texte à la fin, autant faire : <?php $pre_classement_mail = "SELECT mail FROM membre"; $connect_classement_mail = $connect->query($pre_classement_mail); $liste_mail = ''; while ($classement_mail = mysqli_fetch_array($connect_classement_mail)) { $liste_mail .= $classement_mail['mail'] . ', '; } $liste_mail = substr($liste_mail, 0, strlen($liste_mail)-2) // pour supprimer la dernière virgule ?>  Link to comment Share on other sites More sharing options...
TYBMHI Posted October 2, 2022 Author Share Posted October 2, 2022 Merci énormément BlackPage. C'est parfait. J'adore ce forum ! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now