Re: displaying a rowset in php...same column names - Mailing list pgsql-php

From Gavin M. Roy
Subject Re: displaying a rowset in php...same column names
Date
Msg-id 3FFC5FA9.6020604@ehpg.net
Whole thread Raw
In response to Re: displaying a rowset in php...same column names  (Enver ALTIN <enver.altin@frontsite.com.tr>)
List pgsql-php
>
>
>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.
>
>



pgsql-php by date:

Previous
From: Enver ALTIN
Date:
Subject: Re: displaying a rowset in php...same column names
Next
From: "Gavin M. Roy"
Date:
Subject: Re: [GENERAL] PHP arrays and postgresql