IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Langage PHP Discussion :

[Tableaux] Problème ! Il ne pointe pas sur l'ID que je veux


Sujet :

Langage PHP

  1. #1
    Membre régulier Avatar de bilou95
    Inscrit en
    Septembre 2006
    Messages
    433
    Détails du profil
    Informations forums :
    Inscription : Septembre 2006
    Messages : 433
    Points : 117
    Points
    117
    Par défaut [Tableaux] Problème ! Il ne pointe pas sur l'ID que je veux
    Voici mon code ...

    En fait je désire mettre en place des champs de mise a jour ...
    Le probleme c'est qu'il ne pointe pas sur le bon ID ... Il me met a jour tout les champs "os" de la table demandé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
    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
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    <?php
    require("cnx/login_sql.php");
    
    //Connexion à la base de données
    $db = mysql_connect('localhost', 'root', '') or die ("Erreur de connexion");
    
    //Selection de la base
    mysql_select_db('alliance',$db);
    
    //Recupération de la variable id
    $id=$_GET['id'];
    
    $req_pr="SELECT * FROM spare WHERE id_spare='$id'";
    
    $sql_pr=mysql_query($req_pr) or die ('Erreur SQL !<br>'.$req.'<br>'.mysql_error());
    echo '<IMG src="image/fiche_sp.png" align="left" border=0>';
    while($data=mysql_fetch_assoc($sql_pr))
    	{
    	
    	echo '<DIV align="left"><strong><u><font face="verdana" size="3">'.$data['nom_spare'].'</font></u></strong></br></br>';
    	
     	if($data['modele'] == "ACER")
    	{
    	echo '<table style="border-color:#000000;border-width:1;border-style:dotted">';
    	echo '<tr>';
    	echo '<td align="center">';
    	echo '<IMG src="image/logo-acer.png" border=0>';
    	echo '</td>';
    	echo '<td>';
    	echo '<a href="http://support.acer-euro.com/">Support [www]</a>';
    	echo '</td>';
    	echo '</tr>';
    	echo '</table>';
    	}
    	elseif($data['modele'] == "DELL")
    	{
    	echo '<table style="border-color:#000000;border-width:1;border-style:dotted">';
    	echo '<tr>';
    	echo '<td align="center">';
    	echo '<IMG src="image/logo-dell.png" border=0>';
    	echo '</td>';
    	echo '<td>';
    	echo '<a href="http://support.euro.dell.com/">Support [www]</a>';
    	echo '</td>';
    	echo '</tr>';
    	echo '</table>';
    	}
    	elseif($data['modele'] == "NEC")
    	{
    	echo '<table style="border-color:#000000;border-width:1;border-style:dotted">';
    	echo '<tr>';
    	echo '<td align="center">';
    	echo '<IMG src="image/logo-nec.png" border=0>';
    	echo '</td>';
    	echo '<td>';
    	echo '<a href=" http://www.nec-display-solutions.fr/">Support [www]</a>';
    	echo '</td>';
    	echo '</tr>';
    	echo '</table>';
    	
    	}
    	
    	echo'</br>';
    	echo'</br>';
    	echo '<table border=1 align=center width="80%">';
    	echo '<tr>';
    	echo '<td style="background-image:url(image/bg6box.gif)">Information Matériel</td>';
    	echo '</tr>';
    	echo '</table>';
    	echo '&nbsp';
    	echo '<table style="border-color:#000000;border-width:1;border-style:dashed" width="80%" align=center>';
    	echo '<tr>';
    	echo '<td class="largeur" style="border-color:#000000;border-width:1;border-style:dotted"><strong><font size="1">Modèle</td>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted">eeee</td>';
    	echo'</tr>';
    	echo '<tr>';
    	echo '<td class="largeur" style="border-color:#000000;border-width:1;border-style:dotted"><strong><font size="1">N° série Machine</td>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted">eeee</td>';
    	echo'</tr>';
    	echo '<tr>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted"><strong><font size="1">N° Inventaire [A.H]</td>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted">eeee</td>';
    	echo'</tr>';
    	if($data['os'] == '')
    	{
    	echo '<tr>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted"><strong><font size="1">Système Exploitation</td>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted"><form name="maj_os" method="post" Action="?numlien=fich_spare&id='.$id.'"><input type="text" name="os" value="'.$_POST['os'].'">&nbsp&nbsp<INPUT type=image src="image\stylo.png"  name="imag" alt="mise à jour"></td>';
    	$os=$_POST['os'];
    	$sql_os="UPDATE spare SET os='$os'";
    	$exe_sqlos = mysql_query($sql_os) or die('Erreur SQL !');
    	echo '</form>';
    	}
    	else
    	{
    	echo '<tr>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted"><strong><font size="1">Système Exploitation</td>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted">eeee</td>';
    	echo'</tr>';
    	}
    	echo '<tr>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted"><strong><font size="1">Mémoire vive [R.A.M]</td>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted">eeee</td>';
    	echo'</tr>';
    	echo '<tr>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted"><strong><font size="1">Disque Dur [H.D]</td>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted">eeee</td>';
    	echo'</tr>';
    	echo '<tr>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted"><strong><font size="1">Vidéo [Carte Graphique]</td>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted">eeee</td>';
    	echo'</tr>';
    	echo '<tr>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted"><strong><font size="1">Sans Fil [Wifi]</td>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted">eeee</td>';
    	echo'</tr>';
    	echo '<tr>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted"><strong><font size="1">Carte réseau [LAN]</td>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted">eeee</td>';
    	echo'</tr>';
    	echo'</table>';
    	  	
    	}
    	 
    	
    mysql_close();
    ?>

  2. #2
    Membre expert Avatar de Amara
    Profil pro
    Inscrit en
    Juillet 2004
    Messages
    2 688
    Détails du profil
    Informations personnelles :
    Localisation : France, Sarthe (Pays de la Loire)

    Informations forums :
    Inscription : Juillet 2004
    Messages : 2 688
    Points : 3 115
    Points
    3 115
    Par défaut
    Ca paraît logique tu mets pas de filtre WHERE à ta requête UPDATE donc il met toute la table à jour...
    Pas de questions techniques par MP, le forum est là pour ça et est plus efficace.

    Orthographe : une connexion (avec un x), un langage (sans u), une requête (un seul t), 'une quote' (avec qu), une syntaxe (sans h)

  3. #3
    Membre régulier Avatar de bilou95
    Inscrit en
    Septembre 2006
    Messages
    433
    Détails du profil
    Informations forums :
    Inscription : Septembre 2006
    Messages : 433
    Points : 117
    Points
    117
    Par défaut
    ah putain ...

    Fidele a moi meme AMARA ... L'etourderie ne me perdra pas !

    Merci ca doit etre ca !

  4. #4
    Membre régulier Avatar de bilou95
    Inscrit en
    Septembre 2006
    Messages
    433
    Détails du profil
    Informations forums :
    Inscription : Septembre 2006
    Messages : 433
    Points : 117
    Points
    117
    Par défaut
    Un autre question .. mon probleme est réglé concernant l'ID ...

    Par contre, dés que je clique sur mon lien de validation, je suis obligé de confirmer a 2 reprises ...

    Pourquoi ? Avez vous une idée ?

Discussions similaires

  1. request.getContextPath() ne pointe pas sur l'application web
    Par router_ dans le forum Servlets/JSP
    Réponses: 4
    Dernier message: 25/07/2012, 14h51
  2. Mon context ne pointe pas sur le bon dossier
    Par Baptiste Wicht dans le forum Tomcat et TomEE
    Réponses: 1
    Dernier message: 06/10/2006, 10h13
  3. [Tableaux] Problème d'ajout d'images sur une page
    Par linkman dans le forum Langage
    Réponses: 2
    Dernier message: 29/07/2006, 21h29
  4. Réponses: 2
    Dernier message: 29/05/2006, 12h43
  5. Réponses: 11
    Dernier message: 25/11/2005, 09h52

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo