par
koliom » 18 oct. 2009, 03:37
Voila c'est bon j'ai réussi en faisant:
$sql = "SELECT * FROM infos_tbl WHERE nom='".$nom."' ORDER BY id DESC LIMIT ".$_GET['debut'].','.$nb_affichage_par_page;
Maintenant autre soucis

. Décidemment cette nuit est longue.
Categories.php
La requete:
$sql = 'SELECT * FROM infos_tbl ORDER BY id DESC LIMIT '.$_GET['debut'].','.$nb_affichage_par_page;
// on affiche les résultats
// on affiche le lien
<a href="test2.php?resultats=<?php echo urlencode($data['nom']);?>-<?php echo urlencode($data['prenom']);?>" title="Afficher les prenoms"><?php echo htmlentities(trim($data['prenom'])); ?> <?php echo htmlentities(trim($data['nom'])); ?></a>
// C'est simple je veux afficher la page test2.php?resultats=nom-prenom
Ok ma page test2 (ce qui nous concerne):
if(!empty($_GET['nom'])) {
// On récupère et protège la variable
$nom=mysql_real_escape_string($_GET['nom']);
// On crée la requête qui récupère les prénoms
$sql = "SELECT * FROM infos_tbl WHERE nom='".$nom."' ORDER BY id DESC LIMIT ".$_GET['debut'].','.$nb_affichage_par_page;
J'ai récupéré ce qu'on avait fait plus haut.
Il me faut donc integrer la variable prenom dans la requete et la déclarer.
Pour l'intregrer dans ma requete, je pense que c'est simple et ressemble à ceci:
$sql = "SELECT * FROM infos_tbl WHERE nom='".$nom."' AND prenom='".$prenom."' ORDER BY id DESC LIMIT ".$_GET['debut'].','.$nb_affichage_par_page;
Mon problème, comment la déclarer avant ?