Thread: Re: PHP and inet data type

Re: PHP and inet data type

From
"K Parker"
Date:
>> Seems like the cleanest answer would be to
>> teach PHP about inet data
>> type (not to mention other extension types).

> I'd like to do that, but I don't even know
> where to begin.

I am currently using 'inet' fields in an
application that uses PHP 3.0.14, and it
works fine, e.g:

  select session_ip from acct where session_ip is not null;

  pg_FieldType() says the column is 'inet' and  the results print like this w/o any special effort:

    10.0.0.3
    10.0.0.4
    10.0.0.54
    10.0.0.158

Updates work just as easily:

    if (! ($update = pg_exec( $conn,
                "update acct set session_ip = '$REMOTE_ADDR', \
                last_login = 'now'::text where account = $data[0]")))




Join 18 million Eudora users by signing up for a free Eudora Web-Mail account at http://www.eudoramail.com

Re: Re: PHP and inet data type

From
Andrew Sullivan
Date:
On Wed, Jun 07, 2000 at 11:47:49AM -0700, K Parker wrote:
> >> Seems like the cleanest answer would be to
> >> teach PHP about inet data
> >> type (not to mention other extension types).
>
> > I'd like to do that, but I don't even know
> > where to begin.
>
> I am currently using 'inet' fields in an
> application that uses PHP 3.0.14, and it
> works fine, e.g:

Hmm.  PHP complained when I did it, claiming it didn't support that data
type.  Thanks for this, though.  It must be more incompetence on my part.
I'm getting tired of learning from experience!

--
Andrew Sullivan                                      Computer Services
<sullivana@bpl.on.ca>                        Burlington Public Library
+1 905 639 3611 x158                                   2331 New Street
                                   Burlington, Ontario, Canada L7R 1J4

Re: Re: PHP and inet data type

From
mikeo
Date:
just a curiosity question...is the pg_FieldType() function
something you wrote yourself?  i was unable to find it and,
as i'm new to postgres, want to know everything yesterday...  :)

mikeo


>
>  pg_FieldType() says the column is 'inet' and  the results print like
this w/o any special effort:
>

>    10.0.0.3
>    10.0.0.4
>    10.0.0.54
>    10.0.0.158
>
>Updates work just as easily:
>
>    if (! ($update = pg_exec( $conn,
>                "update acct set session_ip = '$REMOTE_ADDR', \
>                last_login = 'now'::text where account = $data[0]")))
>
>
>
>
>Join 18 million Eudora users by signing up for a free Eudora Web-Mail
account at http://www.eudoramail.com
>

Re: Re: PHP and inet data type

From
Ron Peterson
Date:
mikeo wrote:
>
> just a curiosity question...is the pg_FieldType() function
> something you wrote yourself?

It's a PHP function.

-Ron-