<?php
require_once "conexion.php";


class ModeloArea {

    static public function MdlMostrarArea($tabla, $item, $valor){

        if($item != null){

            $stmt = Conexion:: conectar()->prepare("SELECT p.*
            FROM $tabla p
            WHERE p.$item = :$item");

            $stmt -> bindParam(":".$item, $valor, PDO::PARAM_STR);
            
            $stmt -> execute();

            return $stmt -> fetch();

        }else {

            $stmt = Conexion:: conectar()->prepare("SELECT * FROM $tabla WHERE estado = 1");
            
            $stmt -> execute();

            return $stmt -> fetchAll();
        }

        $stmt -> close();

        $stmt = null;
    }

}