Domnic
Domnic

Reputation: 3867

Deleting multiple rows in datagrid using checkbox

how to Deleting multiple rows in datagrid using checkbox

not in gridview .....pls give solution

Upvotes: 0

Views: 1827

Answers (1)

geek
geek

Reputation: 11

$action = $_GET["action"];
    if($action == "delete") {
        $usersToDelete = "";
        foreach ($_REQUEST['checkbox'] as $id) {
            if($usersToDelete == "") {
                $usersToDelete = "'" . $id . "'";
            } else {
                $usersToDelete = $usersToDelete . ",'" . $id . "'";
            }
        }
        $sql = "DELETE FROM table_name WHERE id in ($usersToDelete)";
        mysql_query($sql) or die('Error: ' . mysql_error());
}
ob_end_flush();

Upvotes: 1

Related Questions