Re: PHP and inet data type

K Parker <kparker@eudoramail.com>

From: "K Parker" <kparker@eudoramail.com>
To: pgsql-general@hub.org
Date: 2000-06-07T18:47:49Z
Lists: pgsql-general
>> 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