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.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.