Voilà, j'ai trois select imbriqués avant un update et mon problème est que le troisième select ne retourne rien alors qu'après vérification dans ma base, il devrait me renvoyer une valeur.

Je ne comprends pas pourquoi, si vous avez une idée...

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
$table="engin";
$champs="numcha";
$predicat=" numsoceng=21";
 
 
$result_select=select($table, $champs, $predicat);
//$table_up="clients";
//$champs_up="numcli";
while($row_numcha=mysql_fetch_row($result_select))
{
	echo "<br><br><br>Numéro chariot: ".$row_numcha[0]."<br>";
	if($row_numcha[0]!='')
	{
		$table_matrp="MATRP";
		$champs_matrp="MAPOSC";
		$predicat_matrp="MACODE='".$row_numcha[0]."'";
 
		$result_matrp=select($table_matrp, $champs_matrp, $predicat_matrp);
 
		while($row_matrp=mysql_fetch_row($result_matrp))
		{
			//$row_matrp=mysql_fetch_row($result_matrp);
			$var=$row_matrp[0];
			$table_pasclil="PASCLIL";
			$champs_pasclil="PCNUCL";
			$predicat_pasclil="PCCLLO='".$var."'";
 
			$result_pasclil=select($table_pasclil, $champs_pasclil, $predicat_pasclil);
			//echo "PCNUCL: ".$row_pasclil[0]."<br>";
			echo "MAPOSC: ".$var."<br>";
			echo "<br>Result pasclil: ".$result_pasclil."<br>";
 
			while($row_pasclil=mysql_fetch_row($result_pasclil))
			{				
				echo "PCNUCL: ".$row_pasclil[0]."<br>";	
				$query="update engin set engcli='".$row_pasclil[0]."' where numcha='".$row_numcha[0]."' and numsoceng=21";
				echo $query."<br><br>";
				$send=mysql_query($query);
 
				//Test envoi de requete
				if (!$send) 
				{
					echo 'Impossible d\'exécuter la requête: '.$query.' '. mysql_error();
					exit;
				}	
 
			}
		}
	}	
 
}
Voici un exemple de la requete qui passe bien dans MySQL mais qui ne me retourne rien à partir du script php:
SELECT PCNUCL FROM PASCLIL WHERE PCCLLO='FORKLITS '