ein Produkt aus seine Liste entfernt

Henrigo007

Mitglied
Hallo Leute,

ich habe ein Problem, wenn ich ein Produkt auf meiner Liste entfernt löscht er nicht das richtige Produkt kann jemand mir sagen, was ich falsches mache?
 
Zuletzt bearbeitet:
Und wo wird gelöscht? Ich sehe keinen Code der etwas löschen sollte.

Hi hast du recht, habe ich das falsche Script geteilt

PHP:
<?php
require_once __DIR__ . '/connection.php';

$img_id    = $_POST['img_id'];
$img_path  = $_POST['img_path'];
$type      = $_POST['type'];
$user      = $_POST['user'];
$sessionID = $_POST['sessionID'];


$data = array();      // array to pass back data

$check = $dbConnect->prepare('DELETE FROM drucker
WHERE img_id  = :img_id
AND img_path  = :img_path
AND type      = :type
AND user      = :user
AND sessionID = :sessionID');

$check->bindValue(':img_id',    $img_id);
$check->bindValue(':img_path',  $img_path);
$check->bindValue(':type',      $type);
$check->bindValue(':user',      $user);
$check->bindValue(':sessionID', $sessionID);
//$check->execute();

if ($check->execute() === true) {
    $data['success'] = true;
} else {
    $data['success'] = false;
}

// return all our data to an AJAX call
echo json_encode($data);
 
Das Script sieht sauber aus. Wie wird es aufgerufen?
Hast du mal die verschiedenen Parameter kontrolliert? Mal nachgeschaut was drin steht?
 
Das Script sieht sauber aus. Wie wird es aufgerufen?
Hast du mal die verschiedenen Parameter kontrolliert? Mal nachgeschaut was drin steht?

von hier wird es aufgerufen das obre script wird druker_remove.php gennant

PHP:
<table border="1">
    <tr>
        <th style = "background-color:#f1f9f9">Pos.</th>
        <th style = "background-color:#f1f9f9">BILD-ID</th>
        <th style = "background-color:#f1f9f9">Typ</th>
        <th style = "background-color:#f1f9f9">BILDPFAD</th>
        <th></th>
    </tr>
    <?php $i = 1;
    while ($prod = $req->fetch(PDO::FETCH_ASSOC)) { ?>

        <tr>
            <td style = "background-color:#D8D8D8"><?php echo $i++ ?></td>
            <td style = "background-color:#D8D8D8"><?php echo($prod['img_id']) ?></td>
            <td style = "background-color:#D8D8D8"><?php echo($prod['type']) ?></td>
            <td style = "background-color:#D8D8D8"><?php echo($prod['img_path']) ?></td>
            <td>
                <form class="remove" method="post" action="drucker_remove.php" name="<?php echo $prod['id'] ?>">
                    <input type="hidden" name="img_id" value="<?php echo $prod['img_id'] ?>">
                    <input type="hidden" name="type" value="<?php echo($prod['type']) ?>">
                    <input type="hidden" name="img_path" value="<?php echo($prod['img_path']) ?>">
                    <input type="hidden" name="user" value="<?php echo $_SESSION['LOGIN'] ?>">
                    <input type="hidden" name="sessionID" value="<?php echo $_SESSION['sessionID'] ?>">
                    <input type="submit" value="Löschen">
                </form>

            </td>
        </tr>

    <?php } ?>

    <tr>
        <th></th>
        <th></th>
        <th></th>
        <th>
            <form class="print_pdf" method="post" action="display.php" name="print">
                <input type="hidden" name="sessionID" value="<?php echo $_SESSION['sessionID'] ?>">
                <input type="image" value="generieren" src="images/obj_pdf.gif">
            </form>
        </th>
        <th></th>
    </tr>
    <tr>
        <th></th>
        <th></th>
        <th></th>
        <th>
            <strong class="download"></strong>
        </th>
        <th></th>
    </tr>
</table>
 
Da kommt man nur mit debuggen weiter. Wie bereits geschrieben. Lass die die Werte ausgeben, die du an die DB übergibst. Kontrolliere sie.
 
Zurück