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 :

insérer requête sql sur bouton afin de modifier la bdd


Sujet :

PHP & Base de données

  1. #1
    Membre régulier
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2016
    Messages
    275
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 34
    Localisation : France, Essonne (Île de France)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2016
    Messages : 275
    Points : 76
    Points
    76
    Par défaut insérer requête sql sur bouton afin de modifier la bdd
    Bonjour j'aimerai mettre une requête sql sur un bouton qui modifirais directement dans la base de donnée comment dois je mis prendre?
    ps je travail sur phpmyadmin
    Merci

  2. #2
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Points : 44 155
    Points
    44 155
    Par défaut
    Qu'est ce qui te pose problème ?
    L'écriture de la requête en SQL ? L'execution de la requête en PHP ? Le bouton HTML ?
    N'oubliez pas de consulter les FAQ PHP et les cours et tutoriels PHP

  3. #3
    Membre régulier
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2016
    Messages
    275
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 34
    Localisation : France, Essonne (Île de France)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2016
    Messages : 275
    Points : 76
    Points
    76
    Par défaut
    l'écriture du sql via un bouton oui_non
    voici html
    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
    <html>
     <html lang="fr">
     <head>
      <meta charset="utf-8" />
      <title>Flotte Mobile</title>
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
      <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
      <script src="dialog.js"></script>
      <link href="Tableau.css" rel="stylesheet" />
      <link rel="stylesheet" type="text/css" href="Bouton.css">
      <link rel="stylesheet" href="dialog.css">
     </head>
     <body>
        <h2 align="center">Affectation</h2><br />
     
       <center>
          <a href="Abonnement.php" class="bouton_dans_page">Abonnement</a>
          <a href="Employe.php" class="bouton_dans_page"> Employe</a>
          <a href="Equipement.php" class="bouton_dans_page"> Equipement</a>
          <a href="Modele.php" class="bouton_dans_page"> Modele</a>
          <a href="Nouvelle_Affectation.php" class="bouton_dans_page"> Nouvelle Affectation</a>
          <a href="Employe.php" class="bouton_dans_page"> Employe</a>
          <a href="Menu_Smartphone.html" class="bouton_dans_page"> Menu Smarphone</a>
       </center>
      <div class="container">
       <br />
       <div class="form-group">
        <div class="input-group">
         <span class="input-group-addon">Recherche</span>
         <input type="text" name="search_text" id="search_text" placeholder="Rechercher par Nom/Opérateur/Num SIM" class="form-control" />
        </div>
       </div>
       <br />
       <div id="result"></div>
      </div>
    <center>
    <div id="dialogoverlay"></div>
    <div id="dialogbox">
      <div>
        <div id="dialogboxhead"></div>
        <div id="dialogboxfoot"></div>
      </div>
    </div>
    <button class="Menu" onclick="Confirm.render()">Suprimer Affectation</button>
    <button class="Menu" type="button">Confirmer Retour Equipement</button>
    <a href="Equipement_Modal.php" class="Menu"> Remplacer Equipement</a> 
    <button class="Menu" type="button">Ajout et Supression Ligne</button> 
    <button class="Menu" type="button">Confirmer Retour Abonnement</button> 
    <button class="Menu" type="button">Reaffectation Equipement</button>
    </center> 
    </body>
    </html>
     
     
    <script>
    $(document).ready(function(){
     
     load_data();
     
     function load_data(query)
     {
      $.ajax({
       url:"fetch_Affect.php",
       method:"POST",
       data:{query:query},
       success:function(data)
       {
        $('#result').html(data);
       }
      });
     }
     $('#search_text').keyup(function(){
      var search = $(this).val();
      if(search != '')
      {
       load_data(search);
      }
      else
      {
       load_data();
      }
     });
    });
     
    </script>
    code pour bouton, tableau, barre de recherche
    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
    <?php
        //PHP avant tout
        if (!empty($_POST)) {
            //la connexion
            $connect = mysqli_connect("localhost", "root", "Mm101010", "smartphone");
     
            //la requete de recherche
            $query = "Select * from vu_affect_empl ";
            if (!empty($_POST["query"])) {
                $search = mysqli_real_escape_string($connect, $_POST["query"]);
                $query .= "WHERE USER_ID LIKE '";
                $query .= $search;
                $query .= "%' OR  USER_ID LIKE '";
                $query .= $search;
                $query .= "%' OR  Num_SIM LIKE '";
                $query .= $search;
                $query .= "%' ORDER BY Nom asc";
            } else {
                $query .= "ORDER BY USER_ID";
            }
            //Lancement de la requete
            $result = mysqli_query($connect, $query);
        }
     
    ?>
    <!DOCTYPE html>
    <html>
    <head>
      <meta charset="utf-8"/>
    </head>
    <body>
    <?php
      if(isset($result) && mysqli_num_rows($result) > 0) {
    ?>
        <div class="table-responsive">
            <table class="table table bordered">
                <tr onclick="SelectLigne(this)">
                    <td>&nbsp;</td>
                    <th>USER ID</th>
                    <th>Nom</th>
                    <th>Prenom</th>
                    <th>Num SIM</th>
                    <th>PIN Terminal</th>
                    <th>PIN SIM</th>
                    <th>Num EMEI</th>
                    <th>Date Debut</th>
                    <th>Date Fin</th>
                    <th>Vitre</th>
                    <th>Coque</th>
                    <th>Support Vehicule</th>
                    <th>Actif</th>
                    <th>Or Affectation1</th>
                    <th>Statut</th>
                </tr>
    <?php 
                while($row = mysqli_fetch_array($result)) {
    ?>
                <tr>
                    <td><input type="checkbox" name="Select[]" value="<?php echo $row['USER_ID'];?>" class="Selection"> </td>
                    <td><?php echo $row["USER_ID"]; ?></td>
                    <td><?php echo $row["Nom"]; ?></td>
                    <td><?php echo $row["Prenom"]; ?></td>
                    <td><?php echo $row["Num_SIM"]; ?></td>
                    <td><?php echo $row["PIN_Terminal"]; ?></td>
                    <td><?php echo $row["PIN_SIM"]; ?></td>
                    <td><?php echo $row["Num_IMEI"]; ?></td>
                    <td><?php echo $row["Date_Debut"]; ?></td>
                    <td><?php echo $row["Date_Fin"]; ?></td>
                    <td><?php echo $row["Vitre"]; ?></td>
                    <td><?php echo $row["Coque"]; ?></td>
                    <td><?php echo $row["Support_Vehicule"]; ?></td>
                    <td><?php echo $row["Actif"]; ?></td>
                    <td><?php echo $row["Or_Affectation1"]; ?></td>
                    <td><?php echo $row["Statut"]; ?></td>
                </tr>
    <?php
               } } else { echo 'Pas enregistrement pour le moment'; }
    ?>
    </body>
    </html>
    oui_non.js
    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
    function CustomAlert(){
    	this.render = function(dialog){
    		var winW = window.innerWidth;
    	    var winH = window.innerHeight;
    		var dialogoverlay = document.getElementById('dialogoverlay');
    	    var dialogbox = document.getElementById('dialogbox');
    		dialogoverlay.style.display = "block";
    	    dialogoverlay.style.height = winH+"px";
    		dialogbox.style.left = (winW/2) - (550 * .5)+"px";
    	    dialogbox.style.top = "100px";
    	    dialogbox.style.display = "block";
    		document.getElementById('dialogboxhead').innerHTML = "Acknowledge This Message";
    	    document.getElementById('dialogboxbody').innerHTML = dialog;
    		document.getElementById('dialogboxfoot').innerHTML = '<button onclick="Alert.ok()">OK</button>';
    	}
    	this.ok = function(){
    		document.getElementById('dialogbox').style.display = "none";
    		document.getElementById('dialogoverlay').style.display = "none";
    	}
    }
    var Alert = new CustomAlert();
    function deletePost(id){
    	var db_id = id.replace("post_", "");
    	// Run Ajax request here to delete post from database
    	document.body.removeChild(document.getElementById(id));
    }
    function CustomConfirm(){
    	this.render = function(dialog,op,id){
    		var winW = window.innerWidth;
    	    var winH = window.innerHeight;
    		var dialogoverlay = document.getElementById('dialogoverlay');
    	    var dialogbox = document.getElementById('dialogbox');
    		dialogoverlay.style.display = "block";
    	    dialogoverlay.style.height = winH+"px";
    		dialogbox.style.left = (winW/2) - (550 * .5)+"px";
    	    dialogbox.style.top = "100px";
    	    dialogbox.style.display = "block";
     
    		document.getElementById('dialogboxhead').innerHTML = "Est-ce que le matériel est déjà retourné ?";
    		document.getElementById('dialogboxfoot').innerHTML = 
    '<button onclick="Confirm.yes(\''+op+'\',\''+id+'\')">Oui</button><button onclick="Confirm.no()">Non</button>';
    	}
    	this.no = function(){
    		document.getElementById('dialogbox').style.display = "none";
    		document.getElementById('dialogoverlay').style.display = "none";
    	}
    	this.yes = function(op,id){
    		if(op == "delete_post"){
    			deletePost(id);
    		}
    		document.getElementById('dialogbox').style.display = "none";
    		document.getElementById('dialogoverlay').style.display = "none";
    	}
    }
    var Confirm = new CustomConfirm();
    et le sql
    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
    OuiNon = MsgBox("Est-ce que le matériel est déjà retourné ?", vbYesNo)
    If OuiNon = vbYes Then
        strmysql = "UPDATE Abonnements SET Abonnements.Statut_Abo = ""Non Affecté"""
        strmysql = strmysql & " WHERE (Abonnements.Num_SIM = """
        strmysql = strmysql & Numero_puce
        strmysql = strmysql & """);"
    '    DoCmd.RunSQL strmysql
        Me.Statut_Affectation = "Non Affecté"
            DoCmd.RunCommand acCmdSaveRecord
     
    MyDate = Date$
    User = Environ("USERNAME")
        RunMySQL = "INSERT INTO [Arch_Affectation] (Or_Affectation, USER_ID, PIN_Terminal, PIN_SIM, Coque, Vitre, Support_Vehicule, Num_EMEI,Num_SIM, Date_Début, Date_Fin, Actif, Statut_Affectation, Commentaire, Auteur, Date_Maj, Desc_Action )"
        RunMySQL = RunMySQL & " select Or_Affectation, USER_ID, PIN_Terminal, PIN_SIM, Coque, Vitre, Support_Vehicule, Num_EMEI,Num_SIM , Date_Début, #"
        RunMySQL = RunMySQL & MyDate
        RunMySQL = RunMySQL & "#, Actif, Statut_Affectation, Commentaire, """
        RunMySQL = RunMySQL & User
        RunMySQL = RunMySQL & """, #"
        RunMySQL = RunMySQL & MyDate
        RunMySQL = RunMySQL & "#, ""Supprimer Affectation"""
        RunMySQL = RunMySQL & " FROM [Affectation] WHERE [Affectation].Or_Affectation =" & Me.Or_Affectation & ";"
            DoCmd.RunSQL RunMySQL
     
            DoCmd.RunSQL " UPDATE [Equipement] INNER JOIN [Affectation] ON [Equipement].Num_EMEI = [Affectation].Num_EMEI SET [Equipement].Statut_Equipement =""Non Affecté""" _
             & " WHERE Equipement.Num_EMEI='" & Me.Num_EMEI & "'"
     
    ElseIf OuiNon = vbNo Then
        strmysql = "UPDATE Abonnements SET Abonnements.Statut_Abo = ""Attente Retour"""
        strmysql = strmysql & " WHERE (Abonnements.Num_SIM = """
        strmysql = strmysql & Numero_puce
        strmysql = strmysql & """);"
    '    DoCmd.RunSQL strmysql
        Me.Statut_Affectation = "Attente Retour"
            DoCmd.RunCommand acCmdSaveRecord
     
    MyDate = Date$
    User = Environ("USERNAME")
        RunMySQL = "INSERT INTO [Arch_Affectation] (Or_Affectation, USER_ID, PIN_Terminal, PIN_SIM, Coque, Vitre, Support_Vehicule, Num_EMEI,Num_SIM, Date_Début, Date_Fin, Actif, Statut_Affectation, Commentaire, Auteur, Date_Maj, Desc_Action )"
        RunMySQL = RunMySQL & " select Or_Affectation, USER_ID, PIN_Terminal, PIN_SIM, Coque, Vitre, Support_Vehicule, Num_EMEI,Num_SIM , Date_Début, #"
        RunMySQL = RunMySQL & MyDate
        RunMySQL = RunMySQL & "#, Actif, Statut_Affectation, Commentaire,"""
        RunMySQL = RunMySQL & User
        RunMySQL = RunMySQL & """, #"
        RunMySQL = RunMySQL & MyDate
        RunMySQL = RunMySQL & "#, ""Supprimer Affectation - Attente Retour"""
        RunMySQL = RunMySQL & " FROM [Affectation] WHERE [Affectation].Or_Affectation =" & Me.Or_Affectation & ";"
            DoCmd.RunSQL RunMySQL
     
            DoCmd.RunSQL " UPDATE [Equipement] INNER JOIN [Affectation] ON [Equipement].Num_EMEI = [Affectation].Num_EMEI SET [Equipement].Statut_Equipement =""Attente Retour""" _
             & " WHERE Equipement.Num_EMEI='" & Me.Num_EMEI & "'"
    ps la requete vien de access
    merci

  4. #4
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Points : 44 155
    Points
    44 155
    Par défaut
    Si tu mets du code Access, c'est un peu normal que ça ne fonctionne pas.
    N'oubliez pas de consulter les FAQ PHP et les cours et tutoriels PHP

  5. #5
    Membre régulier
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2016
    Messages
    275
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 34
    Localisation : France, Essonne (Île de France)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2016
    Messages : 275
    Points : 76
    Points
    76
    Par défaut
    peux tu m'aider a l'incorporé le sql dans ma page au moins me montrez comment s'y prendre s'il vous plais

  6. #6
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Points : 44 155
    Points
    44 155
    N'oubliez pas de consulter les FAQ PHP et les cours et tutoriels PHP

  7. #7
    Membre régulier
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2016
    Messages
    275
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 34
    Localisation : France, Essonne (Île de France)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2016
    Messages : 275
    Points : 76
    Points
    76
    Par défaut
    mais para-port a un bouton je dois créé une une classe pour permettre d'appliqué le SQL?

  8. #8
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Points : 44 155
    Points
    44 155
    Par défaut
    Une classe non.
    Un simple code PHP qui excecute la requête sera suffisant.
    N'oubliez pas de consulter les FAQ PHP et les cours et tutoriels PHP

  9. #9
    Membre régulier
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2016
    Messages
    275
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 34
    Localisation : France, Essonne (Île de France)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2016
    Messages : 275
    Points : 76
    Points
    76
    Par défaut
    j'ai suivi les indication précédament données mais le soucis c'est qui me signal aucune erreur et pourtant le code ne fonctionne pas
    voici ma page
    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
    128
    129
    130
    131
    132
    133
    134
    135
    <html>
     <html lang="fr">
     <head>
      <meta charset="utf-8" />
      <title>Flotte Mobile</title>
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
      <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
      <script src="dialog.js"></script>
      <link href="Tableau.css" rel="stylesheet" />
      <link rel="stylesheet" type="text/css" href="Bouton.css">
      <link rel="stylesheet" href="dialog.css">
     </head>
     <body>
        <h2 align="center">Affectation</h2><br />
     
       <center>
          <a href="Abonnement.php" class="bouton_dans_page">Abonnement</a>
          <a href="Employe.php" class="bouton_dans_page"> Employe</a>
          <a href="Equipement.php" class="bouton_dans_page"> Equipement</a>
          <a href="Modele.php" class="bouton_dans_page"> Modele</a>
          <a href="Nouvelle_Affectation.php" class="bouton_dans_page"> Nouvelle Affectation</a>
          <a href="Employe.php" class="bouton_dans_page"> Employe</a>
          <a href="Menu_Smartphone.html" class="bouton_dans_page"> Menu Smarphone</a>
       </center>
      <div class="container">
       <br />
       <div class="form-group">
        <div class="input-group">
         <span class="input-group-addon">Recherche</span>
         <input type="text" name="search_text" id="search_text" placeholder="Rechercher par Nom/Opérateur/Num SIM" class="form-control" />
        </div>
       </div>
       <br />
       <div id="result"></div>
      </div>
    <center>
    <div id="dialogoverlay"></div>
    <div id="dialogbox">
      <div>
        <div id="dialogboxhead"></div>
        <div id="dialogboxfoot"></div>
      </div>
    </div>
    <button class="Menu" onclick="Confirm.render()" value="
    If Oui = onclick='Confirm.yes' Then
        strmysql = 'UPDATE Abonnements SET Abonnements.Statut_Abo = ''Non Affecter'''
        strmysql = strmysql & ' WHERE (Abonnements.Num_SIM = '''
        strmysql = strmysql & Numero_puce
        strmysql = strmysql & ''');'
    '    DoCmd.RunSQL strmysql
        Me.Statut_Affectation = 'Non Affecté'
            DoCmd.RunCommand acCmdSaveRecord
     
    MyDate = Date$
    User = Environ 'USERNAME'
        RunMySQL = 'INSERT INTO [Arch_Affectation] Or_Affectation, USER_ID, PIN_Terminal, PIN_SIM, Coque, Vitre, Support_Vehicule, Num_EMEI,Num_SIM, Date_Début, Date_Fin, Actif, Statut_Affectation, Commentaire, Auteur, Date_Maj, Desc_Action'
        RunMySQL = RunMySQL & ' select Or_Affectation, USER_ID, PIN_Terminal, PIN_SIM, Coque, Vitre, Support_Vehicule, Num_EMEI,Num_SIM , Date_Début, #'
        RunMySQL = RunMySQL & MyDate
        RunMySQL = RunMySQL & '#, Actif, Statut_Affectation, Commentaire, '''
        RunMySQL = RunMySQL & User
        RunMySQL = RunMySQL & ''', #'
        RunMySQL = RunMySQL & MyDate
        RunMySQL = RunMySQL & '#, ''Supprimer Affectation'''
        RunMySQL = RunMySQL & ' FROM [Affectation] WHERE [Affectation].Or_Affectation =' & Me.Or_Affectation & ';'
            DoCmd.RunSQL RunMySQL
     
            DoCmd.RunSQL ' UPDATE [Equipement] INNER JOIN [Affectation] ON [Equipement].Num_EMEI = [Affectation].Num_EMEI SET [Equipement].Statut_Equipement =''Non Affecté''' _
             & ' WHERE Equipement.Num_EMEI='' & Me.Num_EMEI & '''
     
    ElseIf Non = onclick='Confirm.yes' Then
        strmysql = 'UPDATE Abonnements SET Abonnements.Statut_Abo = ''Attente Retour'''
        strmysql = strmysql & ' WHERE Abonnements.Num_SIM = '''
        strmysql = strmysql & Numero_puce
        strmysql = strmysql & ''';'
    '    DoCmd.RunSQL strmysql
        Me.Statut_Affectation = 'Attente Retour'
            DoCmd.RunCommand acCmdSaveRecord
     
    MyDate = Date$
    User = Environ 'USERNAME'
        RunMySQL = 'INSERT INTO [Arch_Affectation] Or_Affectation, USER_ID, PIN_Terminal, PIN_SIM, Coque, Vitre, Support_Vehicule, Num_EMEI,Num_SIM, Date_Début, Date_Fin, Actif, Statut_Affectation, Commentaire, Auteur, Date_Maj, Desc_Action '
        RunMySQL = RunMySQL & ' select Or_Affectation, USER_ID, PIN_Terminal, PIN_SIM, Coque, Vitre, Support_Vehicule, Num_EMEI,Num_SIM , Date_Début, #'
        RunMySQL = RunMySQL & MyDate
        RunMySQL = RunMySQL & '#, Actif, Statut_Affectation, Commentaire,'''
        RunMySQL = RunMySQL & User
        RunMySQL = RunMySQL & ''', #'
        RunMySQL = RunMySQL & MyDate
        RunMySQL = RunMySQL & '#, ''Supprimer Affectation - Attente Retour'''
        RunMySQL = RunMySQL & ' FROM [Affectation] WHERE [Affectation].Or_Affectation =' & Me.Or_Affectation & ';'
            DoCmd.RunSQL RunMySQL
     
            DoCmd.RunSQL ' UPDATE [Equipement] INNER JOIN [Affectation] ON [Equipement].Num_EMEI = [Affectation].Num_EMEI SET [Equipement].Statut_Equipement =''Attente Retour''' _
             & ' WHERE Equipement.Num_EMEI='' & Me.Num_EMEI & '''
    ">Suprimer Affectation</button>
    <button class="Menu" type="button">Confirmer Retour Equipement</button>
    <a href="Equipement_Modal.php" class="Menu"> Remplacer Equipement</a> 
    <button class="Menu" type="button">Ajout et Supression Ligne</button> 
    <button class="Menu" type="button">Confirmer Retour Abonnement</button> 
    <button class="Menu" type="button">Reaffectation Equipement</button>
    </center> 
    </body>
    </html>
     
     
    <script>
    $(document).ready(function(){
     
     load_data();
     
     function load_data(query)
     {
      $.ajax({
       url:"fetch_Affect.php",
       method:"POST",
       data:{query:query},
       success:function(data)
       {
        $('#result').html(data);
       }
      });
     }
     $('#search_text').keyup(function(){
      var search = $(this).val();
      if(search != '')
      {
       load_data(search);
      }
      else
      {
       load_data();
      }
     });
    });
     
    </script>
    le code de boite de dialogue oui/non
    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
    function CustomAlert(){
    	this.render = function(dialog){
    		var winW = window.innerWidth;
    	    var winH = window.innerHeight;
    		var dialogoverlay = document.getElementById('dialogoverlay');
    	    var dialogbox = document.getElementById('dialogbox');
    		dialogoverlay.style.display = "block";
    	    dialogoverlay.style.height = winH+"px";
    		dialogbox.style.left = (winW/2) - (550 * .5)+"px";
    	    dialogbox.style.top = "100px";
    	    dialogbox.style.display = "block";
    		document.getElementById('dialogboxhead').innerHTML = "Acknowledge This Message";
    		document.getElementById('dialogboxfoot').innerHTML = '<button onclick="Alert.ok()">OK</button>';
    	}
    	this.ok = function(){
    		document.getElementById('dialogbox').style.display = "none";
    		document.getElementById('dialogoverlay').style.display = "none";
    	}
    }
    var Alert = new CustomAlert();
    function deletePost(id){
    	var db_id = id.replace("post_", "");
    	document.body.removeChild(document.getElementById(id));
    }
    function CustomConfirm(){
    	this.render = function(dialog,op,id){
    		var winW = window.innerWidth;
    	    var winH = window.innerHeight;
    		var dialogoverlay = document.getElementById('dialogoverlay');
    	    var dialogbox = document.getElementById('dialogbox');
    		dialogoverlay.style.display = "block";
    	    dialogoverlay.style.height = winH+"px";
    		dialogbox.style.left = (winW/2) - (550 * .5)+"px";
    	    dialogbox.style.top = "100px";
    	    dialogbox.style.display = "block";
     
    		document.getElementById('dialogboxhead').innerHTML = "Est-ce que le matériel est déjà retourné ?";
    		document.getElementById('dialogboxfoot').innerHTML = 
    '<button onclick="Confirm.yes(\''+op+'\',\''+id+'\')">Oui</button><button onclick="Confirm.no()">Non</button>';
    	}
    	this.no = function(){
    		document.getElementById('dialogbox').style.display = "none";
    		document.getElementById('dialogoverlay').style.display = "none";
    	}
    	this.yes = function(op,id){
    		if(op == "delete_post"){
    			deletePost(id);
    		}
    		document.getElementById('dialogbox').style.display = "none";
    		document.getElementById('dialogoverlay').style.display = "none";
    	}
    }
    var Confirm = new CustomConfirm();
    merci

  10. #10
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Points : 44 155
    Points
    44 155
    Par défaut
    j'ai suivi les indication précédament données
    Je ne vois pas trop en quoi. Tu as juste collé ton code Access tel quel dans la valeur du bouton (ce qui n'a aucun sens).

    Il te faut une page PHP qui fasse la connexion à la base de données et exécute la requête, c'est tout.

    Une fois que cette page est écrite, il faut que tu l'appelles en Ajax à l'endroit ou c'est écrit dans ton code "// Run Ajax request here to delete post from database" (d'ailleurs tu as étrangement retiré cette indication).
    N'oubliez pas de consulter les FAQ PHP et les cours et tutoriels PHP

Discussions similaires

  1. Réponses: 3
    Dernier message: 11/01/2006, 18h35
  2. requêtes sql sur plusieurs tables
    Par zahiton dans le forum Langage SQL
    Réponses: 4
    Dernier message: 25/11/2005, 10h59
  3. [SQL] requêtes SQL sur plusieurs tables
    Par zahiton dans le forum PHP & Base de données
    Réponses: 2
    Dernier message: 24/11/2005, 16h32
  4. A propos d'une requête SQL sur plusieurs tables...
    Par ylebihan dans le forum Langage SQL
    Réponses: 2
    Dernier message: 14/09/2003, 16h26

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