0

I get the following error: Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 65488 bytes).

<?php
session_start();

require'class/DB.php';

$db = new clsDB();



$getRows = $db->getRows("SELECT * FROM category");

echo "<form method=\"post\" action=\"category.php\">
        <table>";

while($row = $getRows->fetch()){


    ?>
    <tr><td><input type="checkbox" name="checkbox[]" value="<?php echo $row['catId'] ?>"><?php echo $row['catName'];?></td>

        <br />
    </tr>

    <?php


}
?>
        </table>

        <input type="submit" name="delete" value="delete">
        </form>
        <?php
if(isset($_POST['delete'])) {

    foreach ($_POST['checkbox'] as $check) {
        //$deleteRow = $db->deleteRow("DELETE FROM category WHERE catId ='" . $check . "' ");
        $deleteRow = $db->deleteRow("DELETE FROM category WHERE catId = ? ", $check);
    }

}

?>

This is the line where I got the error

public function deleteRow($query, $params = []){
        $this->deleteRow($query, $params);
    }

the line is from my DB class

I don't know how to fix this problem please leave something helpful

Remco de Baas
  • 61
  • 2
  • 11

1 Answers1

2

You can adjust the memory limit:

ini_set('memory_limit', '128M');

change size as per your requirement

Ranjit Shinde
  • 1,121
  • 1
  • 7
  • 22