So $stmt->execute();
=> returns a bool value, whether your query was successfully executed or not, and you can do it simply like this:
function delete_cat($category){
$stmt = $mysqli->prepare("DELETE category, products FROM category INNER JOIN products WHERE category.id = ? AND product_cat = category.category_name ");
$stmt->bind_param($category);
$result = $stmt->execute();
$stmt->close();
return $result;
}
If you needed to get the count of the deleted elements, you can use mysqli_stmt_affected_rows, something like this:
function delete_cat($category){
$stmt = $mysqli->prepare("DELETE category, products FROM category INNER JOIN products WHERE category.id = ? AND product_cat = category.category_name ");
$stmt->bind_param($category);
$stmt->execute();
$result = $stmt->affected_rows;
$stmt->close();
return $result;
}