If the user is selected from other place than check and do not delete otherwise delete it.



 $q = "select * from product_design where design_size = $del_id";
$res = mysqli_query($mysqli,$q);
if(mysqli_num_rows($res) > 0) {

$_SESSION['product_size']['error'][] = "This product size can't Deleted, because it used with some products";
}
else{
$q = "DELETE from product_size where size_id = $del_id";
$res = mysqli_query($mysqli,$q);
$_SESSION['product_size']['success'] = 'Size deleted successfully';
}