salut,

je creer le script suivant;

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
<?
 
 
 
$db=mysql_connect('localhost','root','root') or die("conect errone"); 
 
mysql_select_db('glpi',$db) or die("erreur"); 
 
// la valeur qu'on doit entrer
 
 
$otherserial =$_POST['otherserial'];
 
$req=mysql_query("select `otherserial`,`serial`,`name`,`contact` from glpi_computers  where otherserial = '".$otherserial ."' "); 
 
$nombre_de_ligne = mysql_affected_rows();
 
if ($nombre_de_ligne > 0 )
 
// test pour verifier si la valeur du "otherserial" entrer correspond a la valeur trouver
 
 
{
 
// si le numero entrer est juste donc on doit remplir la table 'inventaire"
 
 $query=("
INSERT INTO `inventaire` 
SELECT otherserial,SSN, completename,PROCESSORT,`memories`.DESCRIPTION,CAPACITY,`slots`.NAME,DESIGNATION,LETTER,`drives`.TYPE,MANUFACTURER,`monitors`.SERIAL,`networks`.SPEED
FROM  `OCSWEB`.`bios` 
INNER JOIN `OCSWEB`.`hardware` ON `OCSWEB`.`bios`.hardware_id
 = `OCSWEB`.`hardware`.ID 
 INNER JOIN `OCSWEB`.`memories` ON `OCSWEB`.`bios`.hardware_id
 = `OCSWEB`.`memories`.hardware_id 
 INNER JOIN `OCSWEB`.`slots` ON `OCSWEB`.`memories`.hardware_id
 = `OCSWEB`.`slots`.hardware_id
 INNER JOIN `OCSWEB`.`drives` ON `OCSWEB`.`slots`.hardware_id
 = `OCSWEB`.`drives`.hardware_id
 INNER JOIN `OCSWEB`.`monitors` ON `OCSWEB`.`drives`.hardware_id
 = `OCSWEB`.`monitors`.hardware_id
 INNER JOIN `OCSWEB`.`networks` ON `OCSWEB`.`monitors`.hardware_id
 = `OCSWEB`.`networks`.hardware_id
INNER JOIN `GLPI`.`glpi_computers` ON `OCSWEB`.`bios`.SSN = `GLPI`.`glpi_computers`.serial
INNER JOIN `GLPI`.`glpi_dropdown_locations` ON `GLPI`.`glpi_computers`.location = `GLPI`.`glpi_dropdown_locations`.ID");
 
$result=mysql_query($query) ;
 
$resultat=mysql_query("SELECT 
`otherserial`,`SSN`,`completename`,`PROCESSORT`,`DESCRIPTION`,`CAPACITY`,`NAME`,`DESIGNATION`,`LETTER`,`TYPE`,`MANUFACTURER`,`SERIAL`,`SPEED` FROM inventaire");
 
while ($resultat2 = mysql_fetch_array($resultat)) 
{ 
print "numero d'inventaire :.$resultat2[otherserial].numero_seie :.$resultat2[SSN].lieu :.$resultat2[completename].PROCESSORT :.$resultat2[PROCESSORT].DESCRIPTION_RAM :.$resultat2[DESCRIPTION].CAPACITY :.$resultat2[CAPACITY].SLOTS:.$resultat2[NAME].DESIGNATION :.$resultat2[DESIGNATION].DISQUES :.$resultat2[LETTER].TYPE :.$resultat2[TYPE].ECRAN :.$resultat2[MANUFACTURER].SERIAL :.$resultat2[SERIAL].LAN :.$resultat2[SPEED]<br>"; 
 
 
}
}
else
 
 echo "numero "otherserial" entrer est erroné";
 
 
 
mysql_close();
 
 
?>


le probleme est le suivant;

quand je saisie une valeur "otherserial" qui ne trouve pas dans la table

"glpi_computers" alors le message d'erreur apparu avec succe


mais le probleme suppose quant je saisie une valeur justa

l'affichage normalement doit etre relié par le numero de "otherserial"

mais dans mon ca il affiche
("otherserial,SSN,completename,PROCESSORT,DESCRIPTION,CAPACITY,NAME,DESIGNATION,LETTER,TYPE,MANUFACTURER,SERIAL,SPEED")

pour le numero d'inventaire entré et aussi les memes informations pour

tout les numeros de "otherserial" qui sont trouvés dans la table "glpi_computers"

MERCI D'AVANCE