<?php
session_start();
require_once '../Conexion/conexion.php';
require_once('../Conexion/ConexionPDO.php');
$anno = $_SESSION['anno'];
$cuenta = $_REQUEST['cuenta'];
$anno  = $_SESSION['anno'];
$con = new ConexionPDO();
echo '<option value="">Centro Costo</option>';
$result = $con->Listar("SELECT id_unico,nombre FROM gf_centro_costo WHERE parametrizacionanno = $anno");
// $result = $mysqli->query($sql);

// while($row = mysqli_fetch_row($result)){
for ($row = 0; $row < count($result); $row++) {
    echo '<option value="' . $result[$row][0] . '">' . ucwords(mb_strtolower($result[$row][1])) . '</option>';
}
// $filas = $mysqli->num_rows($result);
$filas = count($result);
if ($filas == 0) {
    echo '<option value="">Centro Costo</option>';
    $res = $con->Listar("SELECT id_unico,nombre FROM gf_centro_costo WHERE parametrizacionanno = $anno");
    // $res = $mysqli->query($sql);
    // while($fila = mysqli_fetch_row($res)){
    for ($fila = 0; $fila < count($res); $fila++) {
        echo '<option value="' . $res[$fila][0] . '">' . ucwords(mb_strtolower($res[$fila][1])) . '</option>';
    }
}
