Bonjour Messieurs,

J'ai un projet de diplôme qui à un bug dont je n'arrive pas à trouver la cause

Ça fait plusieurs jours que j tourne autour et je n'arrive pas à faire ce que je veux.

Pour résumer. j'ai deux clés étrangères envoyé depuis une table utilisateur (fk_pk_tec, fk_pk_cli) sur une table tâche.

Lorsque je fais un ajout, tout fonctionne très bien mais lorsque je modifie, je n'arrive pas à récupérer la pk de mes listes déroulantes.

Client et Technicien sont des alias dans ma base de données.

Pour être encore plus précis, ces fichiers PHP interagissent avec une appli ExtJS

Voilà mon code.

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
<?php
/**
 * This is general file which contains
 * connection file, common function file, etc.,
 *
 */
    require "connection.php";
 
	$fk_pk_cli = $_REQUEST['comboClient-inputEl'];
	$fk_pk_tec = $_REQUEST['comboTechnicien-inputEl'];
	$fk_pk_statac = $_REQUEST['comboStatutTache-inputEl'];
	$fk_pk_inf = $_REQUEST['comboInfrastructure-inputEl'];
	$fk_pk_fac = 1;
	$nom_cli = $_REQUEST['client'];
	$nom_tec = $_REQUEST['technicien'];
	$nom_statac = $_REQUEST['nom_statac'];
	$nom_inf = $_REQUEST['nom_inf'];
	$tit_tac = $_REQUEST['tit_tac'];
	$des_tac	= $_REQUEST['des_tac'];
	$datdeb_tac = $_REQUEST['datdeb_tac'];
	$heudeb_tac = $_REQUEST['heudeb_tac'];
	$datfin_tac = $_REQUEST['datfin_tac'];
	$heufin_tac = $_REQUEST['heufin_tac'];
	$cat_tac = $_REQUEST['cat_tac'];
	$urg_tac = $_REQUEST['urg_tac'];
	$pri_tac = $_REQUEST['pri_tac'];
 
	//print_r $REQUEST[];
 
	if(isset($_REQUEST['pk_tac']))
	{
		 $requeteclient = "Select pk_uti from tb_utilisateur where client = '$nom_cli'";
		 $execclient = mysql_query($requeteclient) or die ("Erreur dans la requête ExecClient".mysql_error()); 
		 $clientid=mysql_fetch_assoc($execclient);
		 $selectclient= $clientid["pk_uti"];
		 echo $selectclient;
 
		$requetetechnicien = "Select pk_uti from tb_utilisateur where technicien = '$nom_tec'";
		$exectechnicien = mysql_query($requetetechnicien) or die ("Erreur dans la requête ExecTechnicien".mysql_error()); 
		$technicienid=mysql_fetch_assoc($exectechnicien);
		$selecttechnicien= $technicienid["pk_uti"];
		echo $selecttechnicien;
 
 
 
		 $requeteinfrastructure = "Select pk_inf from tb_infrastructure where nom_inf = '$nom_inf'";
		 $execinfrastructure = mysql_query($requeteinfrastructure) or die ("Erreur dans la requête ExecInfrastructure".mysql_error()); 
		 $infrastructureid=mysql_fetch_assoc($execinfrastructure);
		 $selectinfrastructure= $infrastructureid["pk_inf"];
 
		 $requetestatuttache = "Select pk_statac from tb_statut_tache where nom_statac = '$nom_statac'";
		 $execstatuttache = mysql_query($requetestatuttache) or die ("Erreur dans la requête ExecStatutTache".mysql_error()); 
		 $statuttacheid=mysql_fetch_assoc($execstatuttache);
		 $selectstatuttache= $statuttacheid["pk_sta_tac"];
 
		$pk_tac = $_REQUEST['pk_tac'];
		$querytache = "Update tb_tache SET fk_pk_cli = '$selectclient' ,fk_pk_tec = '$selecttechnicien',  fk_pk_statac = '$selectstatuttache', fk_pk_inf = '$selectinfrastructure' , tit_tac = '$tit_tac', des_tac = '$des_tac' , datdeb_tac = '$datdeb_tac', heudeb_tac= '$heudeb_tac , datfin_tac = '$datfin_tac' , heufin_tac = '$heufin_tac' , cat_tac = '$cat_tac', urg_tac = '$urg_tac', pri_tac = '$pri_tac' where pk_tac = '$pk_tac'";	
	}
	else
	{
		$querytache = "Insert into tb_tache (fk_pk_cli, fk_pk_tec, fk_pk_inf, fk_pk_statac, fk_pk_fac, tit_tac, des_tac, datdeb_tac, heudeb_tac, datfin_tac, heufin_tac, cat_tac, urg_tac, pri_tac) values ('$fk_pk_cli','$fk_pk_tec','$fk_pk_inf','$fk_pk_statac','$fk_pk_fac','$tit_tac','$des_tac', '$datdeb_tac', '$heudeb_tac', '$datfin_tac', '$heufin_tac', '$cat_tac','$urg_tac', '$pri_tac')";
	}
	$exectache = mysql_query($querytache) or die ("Erreur dans la requête ExecTache".mysql_error()); 
 
	echo '{"success":"true","msg":""}';	
?>
Merci d'avance