PEAR DB getAssoc()

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

 



Hey all-
    Could someone give an example of how to use the DB_Common::getAssoc()
function?  I'm trying to get an table into an array, and var_dump() shows
that the array is not associative.  Here's the code:

$sql = "select * from sr_names";
$table = $db->getAssoc($sql);
echo var_dump($table);

    And here's the output:

array(1) {
  [1]=>
  array(16) {
    [0]=>
    string(5) "Jacob"
    [1]=>
    string(6) "Marble"
    [2]=>
    NULL
<etc...>

    As I understand it, an associative array should return something more
like:

array(1) {
  [1]=>
  array(16) {
    ['firstname']=>
    string(5) "Jacob"
    ['lastname']=>
    string(6) "Marble"
    ['email']=>
    NULL
<etc...>

    Or am I showing off my newness... ;-)  Any help greatly appreciated!!

Jake

LandEZ



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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux