Bonjour a tous,

voila mon probleme:
j'ai la table postgres suivante:
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
77
78
79
80
81
82
83
84
85
-- 
-- PostgreSQL database dump
-- 
 
SET client_encoding = 'UNICODE';
SET check_function_bodies = false;
 
SET SESSION AUTHORIZATION 'postgres';
 
SET search_path = public, pg_catalog;
 
-- 
-- TOC entry 3 (OID 278527)
-- Name: d_ressource_astre; Type: TABLE; Schema: public; Owner: postgres
-- 
 
CREATE TABLE d_ressource_astre (
    ress_id_ext integer NOT NULL,
    astr_id_ext integer NOT NULL,
    ress_astr_prod integer DEFAULT 0 NOT NULL,
    ress_astr_dispo integer DEFAULT 0 NOT NULL,
    ress_astr_stock integer,
    ress_astr_last_up integer,
    ress_astr_synth integer
);
 
 
-- 
-- Data for TOC entry 5 (OID 278527)
-- Name: d_ressource_astre; Type: TABLE DATA; Schema: public; Owner: postgres
-- 
 
COPY d_ressource_astre (ress_id_ext, astr_id_ext, ress_astr_prod, ress_astr_dispo, ress_astr_stock, ress_astr_last_up, ress_astr_synth) FROM stdin;
1   274011   0   1944696270   0   1157193141   0
2   274011   0   774497016   0   1157193141   0
3   274011   0   335398795   0   1157193141   0
5   274011   0   2000000000   0   1157193141   0
6   274011   0   2000000000   0   1157193141   0
4   274011   0   2000000000   0   1157193141   0
5   274016   0   2000000000   0   1157193141   0
4   267912   0   2000000000   0   1157193141   0
3   274015   0   267008954   0   1157193141   0
5   274015   0   2000000000   0   1157193141   0
1   267916   0   1670645309   0   1157193141   0
2   267916   0   627469911   0   1157193141   0
3   267916   0   390363743   0   1157193141   0
6   274015   0   2000000000   0   1157193141   0
5   267916   0   2000000000   0   1157193141   0
6   267916   0   2000000000   0   1157193141   0
1   274015   0   1489780656   0   1157193141   0
2   274015   0   929031759   0   1157193141   0
4   274015   0   2000000000   0   1157193141   0
3   274016   0   140543093   0   1157193141   0
1   274016   0   519767306   0   1157193141   0
2   274016   0   612344012   0   1157193141   0
6   274016   0   2000000000   0   1157193141   0
1   267908   0   875930028   0   1157193141   0
..........
6   261904   22   1999999202   226   1158539354   11
7   261904   22   1999999202   798   1158539354   11
8   261904   22   1999999202   798   1158539354   33
9   261904   0   2000000000   0   1158539354   0
10   261904   0   2000000000   0   1158539354   0
11   261904   0   2000000000   0   1158539354   0
4   265240   1010   2000000000   0   1158616054   0
1   265240   1010   1999998736   1264   1158620561   0
2   265240   1010   1999998736   1264   1158620561   0
3   265240   1010   1999998736   1264   1158620561   0
5   265240   1010   1999998736   1264   1158620561   0
6   265240   1010   1999998736   1264   1158620561   0
7   265240   1010   1999998736   1264   1158620561   0
8   265240   1010   1999998736   1264   1158620561   0
9   265240   1010   1999998736   1264   1158620561   0
10   265240   1010   1999998736   1264   1158620561   0
11   265240   1010   1999998736   1264   1158620561   0
\.
 
 
-- 
-- TOC entry 4 (OID 278764)
-- Name: d_ressource_astre_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
-- 
 
ALTER TABLE ONLY d_ressource_astre
    ADD CONSTRAINT d_ressource_astre_pkey PRIMARY KEY (astr_id_ext, ress_id_ext);
j'ai creer ma function edit_ress () comme suit:
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
<?PHP
function edit_ress() {
 
   $sql_ress = "SELECT DISTINCT ress_id_ext, astr_id_ext, ress_astr_prod, ress_astr_dispo, ress_astr_stock, ress_astr_last_up, ress_astr_synth
               FROM d_ressource_astre WHERE astr_id_ext = "  . $_GET['id'];
   $req_ress = pg_query($sql_ress);
   $res_ress = pg_fetch_all($req_ress);
 
 
   echo '<table>';
   echo '<tr><th>NOM</th><th>Astre ID</th><th>Production</th><th>Dispo</th><th>Stock</th><th>Last Up</th><th>Synth</th></tr>';
   echo '<form name="edit_astre" action="?page=astre_ressource&amp;op=do_edit_ress&amp;id='.$_GET['id'].'" method="POST">';
 
   foreach($res_ress as $r) {
 
 
      echo '<tr><td><input type="text" name="Nom" value="'.$r['ress_id_ext'].'"></td>';
      echo '<td><input type="text" name="Astre ID" value="'.$r['astr_id_ext'].'"></td>';
      echo '<td><input type="text" name="Production" value="'.$r['ress_astr_prod'].'"></td>';      
      echo '<td><input type="text" name="Dispo" value="'.$r['ress_astr_dispo'].'"></td>';
      echo '<td><input type="text" name="Stock" value="'.$r['ress_astr_stock'].'"></td>';
      echo '<td><input type="text" name="Last Up" value="'.$r['ress_astr_last_up'].'"></td>';
      echo '<td><input type="text" name="Synth" value="'.$r['ress_astr_synth'].'"></td></tr>';
   }
 
   echo '<tr><td></td><td><p><input type="submit" value="Modifier" /></td></tr>';
   echo '</form>';
   echo '<tr><td><p><a href="?page=membres">Retour</a></td></tr>';
   echo'</table>';
}
?>
Le $_GET['id'] et la variable astr_id_ext cela me permet de selectionner uniquement les 11 ress_ext_id de cette astr_id_ext.

je me retrouve donc avec un tableau de 7 colonnes et de 11 lignes
je peux etre ammener a changer une ou plusieurs de ces valeurs.
je recherche donc a creer ma function do_edit_ress().

Comment puis je creer ma requete?

Je ne sais pas si je me suis bien fait comprendre mais j'espere que quelqu'un pourras m'aider.....

Merci a tous.
++