函数PDO查询和多维数组

I'm trying to get a multidimensional array returned from a function.

I want to have the column names as first level and data as second level.

array[columnName][data]

I can var_dump() the function and get the correct output, but I can't echo() the output.

<?php

function fetch_columname($schema,$tablename)
{
    try
    {
        $dbh = new PDO("mysql:host=host;dbname='dbname', 'user', 'pass'");
        $query = $dbh->prepare("SELECT `COLUMN_NAME` FROM    `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA`=:schema AND `TABLE_NAME`=:tablename");
        $query->bindParam(":schema", $schema);
        $query->bindParam(":tablename", $tablename);
        $query->execute();

        $result = array();
        while($row = $query->fetch(PDO::FETCH_ASSOC))
        {
            $result[] = $row;
        }
        $dbh = null;
    }
    catch (PDOException $e)
    {
        print "Error!: " . $e->getMessage() . "<br/>";
        die();
    }
    return $result;
}
$columname = array();
$columname = fetch_columname('new_site','users');
$count = count($columname);

for($i=0;$i<$count;$i++)
{
    echo $columname[$i];
}

From Mike's comment:

Your function would return a two-dimensional array as written, though I am honestly not sure why you want a two-dimensional array considering you are only returning a single field in your query. I would simply change $result[] = $row to $result[] = $row['COLUMN_NAME'] and call it a day.