public static function listar($opc, $campo, $valor) { include "../Conexion/conexion.php"; $mat = array(); if ($opc == 15) { $consulta = "select codigoGenero,nombre,estado from genero where estado = 'a'"; } if ($opc == 16) { if ($campo == 'codigoGenero') { $consulta = "select codigoGenero,nombre,estado from genero where {$campo} = '{$valor}' and estado = 'a'"; } else { $consulta = "select codigoGenero,nombre,estado from genero where {$campo} like '%{$valor}%' and estado = 'a'"; } } else { if ($opc == 17) { $consulta = "select codigoGenero, nombre, estado from genero where codigoGenero= '{$valor}'"; } } $resultado = mysqli_query($cnn, $consulta); $registros = mysqli_num_rows($resultado); if ($registros == 0) { echo "<script type 'text/javascript'>alert('No existen generoes');history.back();</script>"; } else { for ($i = 0; $i < $registros; $i++) { $datos = mysqli_fetch_array($resultado); array_push($mat, genero::mostrar($datos)); } return $mat; } }