I have a code that i want to throw an error if there is no items to delete or if there is items it proceeds with deleting the items, here is what i have so far:

    if (isset($_REQUEST['removeall'])){
            if($_REQUEST['removeall'] == 1){
        mysqli_query($mysqli,"DELETE FROM assets WHERE cust_id = $custID AND del_flag = 1 ");
        if(mysqli_query < 1){
            $result = '<div class="alert alert-warning alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>No assets to delete</div>';
        $result = '<div class="alert alert-success alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>All Assets Deleted</div>';


Am i on the right track? Everytime i request it, it just says All Assets Deleted even though there are no assets flagged.

4 Years
Discussion Span
Last Post by Fernando_4

It will always say "All Assets Deleted", because on line 6 you didn't say it's an else block.

As for the condition itself, it seems you might want to take a look at affected_rows.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.