Looping through results of pg_meta_data()

From: Date: Fri, 22 Oct 2004 16:48:27 +0000
Subject: Looping through results of pg_meta_data()
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-200103@lists.php.net to get a copy of this message
I'm trying to build an html table using the results from pg_meta_data() but none of the access functions seem to work. I am getting results but just can't seem to do anything with them. Here's what I'm using to verify that results are being returned: $connstring = "dbname=pub_status user=postgres host=localhost port=5432"; $db = pg_connect($connstring); $meta = pg_meta_data($db, 'table_definitions'); echo '<pre>'; var_dump($meta); echo '</pre>'; Which yeilds: array(2) { ["field_id"]=> array(5) {
    ["num"]=>
    int(1)
    ["type"]=>
    string(4) "int8"
    ["len"]=>
    int(8)
    ["not null"]=>
    bool(true)
    ["has default"]=>
    bool(true)
} ["field_name"]=> array(5) {
    ["num"]=>
    int(2)
    ["type"]=>
    string(4) "text"
    ["len"]=>
    int(-1)
    ["not null"]=>
    bool(true)
    ["has default"]=>
    bool(false)
} } But none of these seem to do anything: $row_count = pg_num_rows($meta); echo $row_count; -> result a blank web page $row = pg_fetch_row($meta, 0); echo $row; -> result a blank web page $row = pg_fetch_array($meta, 0); echo $row; -> result a blank web page $row = pg_fetch_object($meta, 0); echo $row; -> result a blank web page What am I doing wrong? Thanks for any help, Ken

« previous php.general (#200103) next »