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

PHP & Base de données Discussion :

Modification et suppression bdd avec php


Sujet :

PHP & Base de données

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre éclairé
    Inscrit en
    Décembre 2008
    Messages
    319
    Détails du profil
    Informations forums :
    Inscription : Décembre 2008
    Messages : 319
    Par défaut Modification et suppression bdd avec php
    Bonjour voila, j'ai un fichier bouton.php qui est un menu, celui ci renvoit ver sun autre fichier php label....php qui fais un select sur la première lettre des enttrées de mes champs. (les deux fichiers php sont en dessous

    1) je souhaite a coté de chaque ligne de mon tableau rajouter supprimer et modifier pour que la personne consulte ses entrrées et puisse supprimer et modifier simplement je pense ne pas avoir de souci pour la commande update et delete par contre je ne vois pas comment l afficher a chaque ligne, a coté de chaque entrée ...

    2) comme vous pouvez le voir mon menu comporte 27 boutons qui renvoient vers 27 fichier PHP, connaissez vous un moyen plus simple afin d eviter 27 fichier php

    Merci de votre aide

    bouton.php

    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
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional //EN"
    "http://www.w3.org/TR/xhtmll/DTD/xhtmll-transitional.dtd">
    <html Xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>listing</title>
    <link href="style.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
     
     
     
     
     
     
     
    <ul class="menu">
      <li><a href="bouton.php?page=label0" target="_self" class="active"><span>Label 0-9</span></a></li>
      <li><a href="bouton.php?page=labela" target="_self"><span>Label A</span></a></li>
      <li><a href="bouton.php?page=labelb" target="_self"><span>Label B</span></a></li>
      <li><a href="bouton.php?page=labelc" target="_self"><span>Label C</span></a></li>
      <li><a href="bouton.php?page=labeld" target="_self"><span>Label D</span></a></li>
      <li><a href="bouton.php?page=labele" target="_self"><span>Label E</span></a></li>
      <li><a href="bouton.php?page=labelf" target="_self"><span>Label F</span></a></li>
      <li><a href="bouton.php?page=labelg" target="_self"><span>Label G</span></a></li>
      <li><a href="bouton.php?page=labelh" target="_self"><span>Label H</span></a></li>
      <li><a href="bouton.php?page=labeli" target="_self"><span>Label I</span></a></li>
      <li><a href="bouton.php?page=labelj" target="_self"><span>Label J</span></a></li>
      <li><a href="bouton.php?page=labelk" target="_self"><span>Label K</span></a></li>
      <li><a href="bouton.php?page=labell" target="_self"><span>Label L</span></a></li>
      <li><a href="bouton.php?page=labelm" target="_self"><span>Label M</span></a></li>
      <li><a href="bouton.php?page=labeln" target="_self"><span>Label N</span></a></li>
      <li><a href="bouton.php?page=labelo" target="_self"><span>Label O</span></a></li>
      <li><a href="bouton.php?page=labelp" target="_self"><span>Label P</span></a></li>
      <li><a href="bouton.php?page=labelq" target="_self"><span>Label Q</span></a></li>
      <li><a href="bouton.php?page=labelr" target="_self"><span>Label R</span></a></li>
      <li><a href="bouton.php?page=labels" target="_self"><span>Label S</span></a></li>
      <li><a href="bouton.php?page=labelt" target="_self"><span>Label T</span></a></li>
      <li><a href="bouton.php?page=labelu" target="_self"><span>Label U</span></a></li>
      <li><a href="bouton.php?page=labelv" target="_self"><span>Label V</span></a></li>
      <li><a href="bouton.php?page=labelw" target="_self"><span>Label W</span></a></li>
      <li><a href="bouton.php?page=labelx" target="_self"><span>Label X</span></a></li>
      <li><a href="bouton.php?page=labely" target="_self"><span>Label Y</span></a></li>
      <li><a href="bouton.php?page=labelz" target="_self"><span>Label Z</span></a></li>
     
     
     
     
    <?php
    		if(!empty($_GET['page']))
    		{
    			if(file_exists($_GET['page'].'.php') AND !preg_match("/(\.|config|inc)/iU", $_GET['page']))
    			{
    				include ($_GET['page'].'.php');
    			}
     
     
    		}
     
    		?>
     
     
    </ul>
    </body>
    </html>
    exemple d'un des label...php

    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
    <!DOCTYPE html PUBLIC 
    "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/
    xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
    <head>
        <meta http-equiv="content-type" 
        content="text/html; charset=iso-8859-1" />
        <title>Handsandarms</title>
    <link rel="stylesheet" type="text/css" href="style.css" />
    </head>
    <body>
     
    <br></br>
    <br></br>
    <br></br>
    <br></br>
    <br></br>
     
    <?php
     
    include ('config.php');
    include ('connexion.php'); 
     
    echo '<table>
    
      <tr>
     
        <th>Label</th>
        <th>Référence</th>
        <th>Artiste</th>
        <th>Album</th>
        <th>Format</th>
       
      </tr>';
     
    $sql = "SELECT * FROM label
    INNER JOIN contenu ON contenu.id_label = label.id_label
    Where nom_label LIKE 'a%' order by nom_label, reference;
    ";
    $req = mysql_query($sql);
    while ($resultat = mysql_fetch_array($req))
     
     
    {
       echo '<tr>';
     
     
        echo '<td>'.$resultat['nom_label'].'</td>';
       echo '<td>'.$resultat['reference'].'</td>';
       echo '<td>'.$resultat['artiste'].'</td>';
       echo '<td>'.$resultat['album'].'</td>';
       echo '<td>'.$resultat['format'].'</td>';
     
     
     
     
     
       echo '</tr>';
    }
     
    echo '</table>';
     
    ?>
     
    </body></html>
     
    <?php
    mysql_close();
    ?>

  2. #2
    Rédacteur
    Avatar de RideKick
    Homme Profil pro
    Directeur technique
    Inscrit en
    Septembre 2006
    Messages
    5 914
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Directeur technique
    Secteur : High Tech - Produits et services télécom et Internet

    Informations forums :
    Inscription : Septembre 2006
    Messages : 5 914
    Par défaut
    Salut ,

    (J'ai lu en diagonale)

    Pourquoi ne pas avoir un fichier PHP de base avec des liens qui passent en paramètre (GET) la lettre choisie , en face tu as 1 seul Fichier PHP qui fait la requête select en fonction du paramètre passé , c'est quand même aussi a ça que ça sert PHP ?
    Pas de questions techniques en MP please

    Mon site perso

    Mon profil Viadeo

  3. #3
    Membre éclairé
    Inscrit en
    Décembre 2008
    Messages
    319
    Détails du profil
    Informations forums :
    Inscription : Décembre 2008
    Messages : 319
    Par défaut
    Merci de ta reponse je vais tester tu as pa sune idee pour la modification et suppression merci

  4. #4
    Rédacteur
    Avatar de RideKick
    Homme Profil pro
    Directeur technique
    Inscrit en
    Septembre 2006
    Messages
    5 914
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Directeur technique
    Secteur : High Tech - Produits et services télécom et Internet

    Informations forums :
    Inscription : Septembre 2006
    Messages : 5 914
    Par défaut
    MEme principe , une seule page de suppression et une seule de modif avec passage en parametre de la donnée a modifier.
    Pas de questions techniques en MP please

    Mon site perso

    Mon profil Viadeo

Discussions similaires

  1. [MySQL] Modification de la bdd avec mysql_real_escape
    Par madstrix dans le forum PHP & Base de données
    Réponses: 8
    Dernier message: 25/04/2010, 13h43
  2. [ODBC] connexion à differentes BDD avec php et ODBC
    Par tigunn dans le forum PHP & Base de données
    Réponses: 4
    Dernier message: 31/12/2009, 12h17
  3. affiger image d'une bdd avec php
    Par madmax57 dans le forum Langage
    Réponses: 10
    Dernier message: 16/07/2008, 16h07
  4. Comment extraire du xml pour faire une bdd avec php?
    Par baleiney dans le forum XQUERY/SGBD
    Réponses: 9
    Dernier message: 09/03/2008, 14h55
  5. [PostgreSQL] [PostGreSQL] Création d'une bdd avec PHP
    Par damien150 dans le forum PHP & Base de données
    Réponses: 5
    Dernier message: 09/03/2007, 16h13

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