Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Foreach Datenbankauswertung ID

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: German
View previous topic :: View next topic  
Author Message
edwin12345
Smarty n00b


Joined: 08 Jan 2017
Posts: 2

PostPosted: Sat May 13, 2017 11:38 pm    Post subject: Foreach Datenbankauswertung ID Reply with quote

Hallo Leute habe mit Smarty nun neu begonnen und stehe vor einem kleinen Problem und ich komme einfach nicht drauf.
Ich bereite mir mittels foreach die Daten aus der Datenbank auf und gebe Sie dann in einer Tabelle aus. Das funktioniert alles einwandfrei. Nur möchte ich nun Anhand der K_ID welche aus der DB kommt weiterarbeiten sodass ich Werte löschen etc. kann.
Ich habe auch schon die entsprechenden Buttons nur erhalte ich genau bei einem Button den gewünschten Wert zurück und bei den anderen nicht mehr.


Code:

.tpl Datei

 {foreach $ausw as $auswertung}
            <tr>
                <td>{$auswertung.k_id}<br></td>
                <td>{$auswertung.vorname}<br></td>
                <td>{$auswertung.nachname}<br></td>
                <td>{$auswertung.adresse}<br></td>
                <td>{$auswertung.postleitzahl}<br></td>
                <td><button type="submit" class="btn btn-primary btn-md" name="auswahl" id="deleter" value="{$auswertung.k_id}"></td>
            {counter}
                {debug}
            </tr>
        {/foreach}



Code:

.php Datei[JavaScript]

   $('#deleter').click(function(){   


        var k_id = $("#deleter").val();
        alert($("#deleter").val());
/*
        $.ajax({
            url: "ajax.php",
            type: "POST",
            data: { ACTION : "loeschen", K_ID : k_id},
            dataType: "text",
            success: function(data){
                //$('#kunde_hinzu').modal('hide');
                window.location = "kunden.php";
                alert("Der Datensatz wurde gelöscht");

            },
            error: function(xhr, status, error){
                alert(error + " Fehler beim Löschen");
            }
        });
*/
    });



Danke für eure Hilfe Smile
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Sun May 14, 2017 12:25 am    Post subject: Reply with quote

I don't see how this is a Smarty question.
If the HTML your template produces matching your expectations, nothing more Smarty can do.
If you have a question about JQuery - you are on the wrong forum.
Back to top
View user's profile Send private message
edwin12345
Smarty n00b


Joined: 08 Jan 2017
Posts: 2

PostPosted: Sun May 14, 2017 7:33 am    Post subject: Reply with quote

Problem behoben, hatte einen kleinen Denkfehler im JQuery Smile
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: German All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP