<?php //on inclus le fichier de connexion à la BDD require_once("connexion_bdd.php"); // Petite fonction utile pour récupérer les variables POST function getPOST($var,$default=NULL){ return isset($_POST[$var])?$_POST[$var]:$default; } // Récupération des variables : //(retire les ACCENTS du nom de tes variables y compris dans ton code html !) $prenom = getPOST("prenom"); $mail = getPOST("mail"); $departement = getPOST("departement"); $nom = getPOST("nom"); $organisation = getPOST("organisation"); // lancement de la requête $req="SELECT `prenom` , `mail` , `departement` , `nom`, `organisation` FROM `personne` WHERE `prenom`='$prenom' and `mail`='$mail' and `departement`='$departement' and `nom`='$nom' and `organisation`= '$organisation '" ; print_r ($_POST); echo $req; // Exécution de la requête $result = mysql_query($req); // Vérification du résultat // Ceci montre la requête envoyée à MySQL ainsi que l'erreur. Utile pour déboguer. if (!$result) { $message = 'Requête invalide : ' . mysql_error() . "\n"; $message .= 'Requête complète : ' . $req; die($message); } // Utilisation du résultat while ($row = mysql_fetch_assoc($result)) { echo $row['prenom']; echo $row['departement']; echo $row['mail']; echo $row['nom']; echo $row['organisation']; } ?>
Array ( [nom] => mo [prenom] => fr [Departement] => gt [mail] => mou [organisation] => org [fonction] => ) SELECT `prenom` , `mail` , `departement` , `nom`, `organisation` FROM `personne` WHERE `prenom`='fr' and `mail`='mou' and `departement`='' and `nom`='mo' and `organisation`= 'org '
SELECT `prenom` , `mail` , `departement` , `nom`, `organisation` FROM `personne` WHERE `prenom`='fr' and `mail`='mou' and `departement`='' and `nom`='mo' and `organisation`= 'org '