Re: displaying a rowset in php...same column names

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





This query: SELECT login, firstname, lastname, date_part('epoch', lastlogin), date_part('epoch', regdate) FROM admin ORDER BY login
results in:

login | firstname | lastname | date_part | date_part

Another way from assigning column names, if you dont want to do that...

instead of pg_Fetch_Object

$data = pg_Fetch_Array($result, $row);

/*
$data[0]: login
$data[1]: firstname
$data[2]: lastname
$data[3]: date_part
$data[4]: date_part
*/

*or*

 $login     = pg_Result($result, 0, 0);
 $firstname = pg_Result($result, 1, 0);
 $lastname  = pg_Result($result, 2, 0);
 $date1     = pg_Result($result, 3, 0);
 $date2     = pg_Result($result, 4, 0);

Hope this helps

Gavin

Enver ALTIN wrote:

On Wed, 2004-01-07 at 05:09, Michael Hanna wrote:
This query: SELECT login, firstname, lastname, date_part('epoch', lastlogin), date_part('epoch', regdate) FROM admin ORDER BY login
results in:

login | firstname | lastname | date_part | date_part

SELECT foo as bar,bar as foo from footable

notice the "as" thingie. It would help.




[Index of Archives]     [Postgresql General]     [Postgresql Admin]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Backpacking]     [Postgresql Jobs]

  Powered by Linux