<?php 
session_start(); 
require_once('../conexion.php');
require_once('../include/sesiones.php');
$fam_id=limpiar($_GET['fam_id']);

$can1=mysqli_query($con,"SELECT * FROM articulos where familias_fam_id ='$fam_id'") or die(mysqli_error($con)); 
    $result = mysqli_num_rows($can1);

    if ($result>=1) { 
        echo '<div class="alert alert-warning alert-dismissable">
                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                <strong>NO!</strong> Se puede eliminar categorias asociados con articulos.
          </div>'; 
    }
    else{ 

$borrar_sql=mysqli_query($con,"DELETE FROM familias WHERE fam_id=$fam_id") or die(mysqli_error($con));

echo    '<div class="alert alert-danger alert-dismissable">
            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
            <strong>Categoria!</strong> Eliminada correctamente.
        </div>';
    }
?>