Bonjour,

J'ai ces 2 erreurs :

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in c:\logiciel\easyphp1-7.2\www\xxxclient\recherche\recherche_avancee_confirmation.php on line 54
Nom Prénom

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in c:\logiciel\easyphp1-7.2\www\xxxclient\recherche\recherche_avancee_confirmation.php on line 72
J'ai testé ma requête et elle m'affiche bien 2 lignes d'enregistrement ! Je ne comprends pas.

SELECT num_cli, nom_cli, prenom_cli FROM CLIENT WHERE num_civ = 2 AND nom_cli = 'DUPONT ORDER BY nom_cli

Je passe par POST la civilité de la personne et son nom.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
 
if ($_POST['civilite'] <> "")
  {
   	 $civilite = 'num_civ = '.$_POST['civilite'];  
  }
    else
  {
   $civilite = "";
  }
 
if ($_POST['nom'] <> "")
  {
   	 $nom = " AND nom_cli = '".strtoupper($_POST['nom'])."'";
  }
    else
  {
     $nom = "";
  }
 
 
 
 
   $req_client = ("SELECT num_cli, nom_cli, prenom_cli FROM CLIENT WHERE ".$civilite." ".$nom." ORDER BY nom_cli");
 
   $res = mysql_query($req_client);
 
   echo $req_client;
   echo '<br><br>';
 
 
   if (!$req_client) {
 
      echo "L'exécution de la requête a échoué.<br>";
      echo mysql_error()."<br>";
 
    }
    else
    {
          // voir s'il y a des résultats dans la requêtes
		 if (mysql_num_rows($req_client) < 0)
		     { 
              echo mysql_error();
			  echo 'Aucun résultat pour cette requête'; 
 
			    }
                  else
				{
                     echo'<table width="100%" border="1">
                            <tr>
                              <td>Nom</td>
                              <td>Prénom</td>
                              <td>&nbsp;</td>
                              <td>&nbsp;</td>
                              <td>&nbsp;</td>
                            </tr>';
 
 
								while(($result=mysql_fetch_row($req_client))!=NULL)
	                               {
                           echo' <tr>
                                   <td>'.$result[1].'</td>
                                   <td>'.$result[2].'</td>
                                   <td><a href="../client_afficher.php?id_client='.$result[0].'">voir la fiche</a></td>
                                   <td><a href="../client_modifier.php?id_client='.$result[0].'">modifier</a></td>
                                   <td>';?>
					  <a href="../client_supprimer.php?id_client=<?php echo $result[0]; ?>" onclick="return(confirm('Etes-vous sûr de vouloir supprimer ce client ?'));">Supprimer</a>
						  <? echo'</td>
                                </tr>';
							       }
                  }
}
                       echo'</table>';
 
 
?>