Looping through results of pg_meta_data()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux