最多只能计数200

时间:2019-06-21 13:28:51

标签: php mysql

我们有一个清单清单,并且清单中显示了清单中的项目数。库存中有227件物品。有一个编辑和删除功能。因此可以编辑和删除前200个项目,但不能编辑201-227项目。有人可以帮我弄不清为什么吗? 我一直在关注这个https://www.studentstutorial.com/php/php-delete-multiple-data-selecting-checkboxes.php

<p>
    <h1>Basement Inventory List</h1>
</p>
<?php
if ($_GET['action'] == 'basement') {
    if ($_REQUEST['submit'] == "Edit") {
        $counta = $_POST["idc"];
        for ($i = 0; $i < count($counta); $i++) {
            $querya = "UPDATE inventory
    SET name='" . $_POST['namec'][$i] . "',
    quantity='" . $_POST['quantityc'][$i] . "',
    qonhand='" . $_POST['qonhandc'][$i] . "',
    units='" . $_POST['unitsc'][$i] . "'
    WHERE id='" . $_POST['idc'][$i] . "'";
            mysqli_query($link, $querya);
        }
        echo '<div class="text-success"><h4>Successfully Edited!</h4></div>';
    } else if ($_REQUEST['submit'] == "Delete") {
        $checkboxb = $_POST['checkc'];
        for ($i = 0; $i < count($checkboxb); $i++) {
            $del_idb = $checkboxb[$i];
            $queryb  = "DELETE FROM inventory
    WHERE id='" . $del_idb . "'";
            mysqli_query($link, $queryb);
        }
        echo '<div class="text-danger"><h4>Successfully Deleted!</h4></div>';
    }
}
?>
<!-- Show Communication from dates selected above -->
<p>
    <div class="table-responsive">
        <form action="fdinventory.php?action=basement#nav-basement" method="post">
            <p>
                <div class="d-flex flex-row align-items-center justify-content-between">
                    <input type="submit" name="submit" class="btn btn-primary" value="Edit">
                    <div class="dropdown no-arrow"><input type="submit" name="submit" class="btn btn-danger" value="Delete"></div>
                </div>
                <p>
                    <table class="table table-striped table-bordered table-hover table-condensed">
                        <thead class="thead-dark">
                            <tr>
                                <th scope="col">Name</th>
                                <th scope="col">Quantity</th>
                                <th scope="col">On Hand</th>
                                <th scope="col">Type</th>
                                <th scope="col">Location</th>
                                <th scope="col">Delete</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php
$queryc = "SELECT *
    FROM inventory
    WHERE ploc='Basement'
    ORDER BY type, name ASC
    LIMIT 500";
$resultc = mysqli_query($link, $queryc);
$countc  = mysqli_num_rows($resultc);
$i       = 0;
while ($rowc = mysqli_fetch_array($resultc)) {
    $namec          = $rowc["name"];
    $idc            = $rowc["id"];
    $quantityc      = $rowc["quantity"];
    $formatqc       = number_format($quantityc, 2) - 0;
    $qonhandc       = $rowc["qonhand"];
    $formatqonhandc = number_format($qonhandc, 2) - 0;
    $unitsc         = $rowc["units"];
    $typec          = $rowc["type"];
    $slocc          = $rowc["sloc"];
    echo '
    <tr>
    <input type="hidden" name="idc[]" value="' . $idc . '">
    <td><input type="text" name="namec[]" value="' . $namec . '" class="form-control form-control-sm"></td>
    <td>
    <div class="d-flex flex-row align-items-center justify-content-between"><b>
    <input type="number" step="any" name="quantityc[]" value="' . $formatqc . '" class="form-control form-control-sm" required>
    </b><div class="dropdown no-arrow"><input type="text" name="unitsc[]" value="' . $unitsc . '" class="form-control form-control-sm" required></i></div>
    </div>
    </td>
    <td><input type="number" step="any" name="qonhandc[]" value="' . $formatqonhandc . '" class="form-control form-control-sm"></td>
    <td>' . $typec . '</td>
    <td>' . $slocc . '</td>
    <td><input type="checkbox" id="checkItem" name="checkc[]" value="' . $idc . '"></td>
    </tr>';
    $i++;
}
?>
                        </tbody>
                    </table>
        </form>
    </div>
</p>

0 个答案:

没有答案