Skip site navigation (1) Skip section navigation (2)

Re: [PHP] postgresql array with PHP

From: Grant <grant(at)conprojan(dot)com(dot)au>
To: darius(at)shell(dot)bourg(dot)net
Cc: pgsql-php(at)postgresql(dot)org, pgsql-interfaces(at)postgresql(dot)org
Subject: Re: [PHP] postgresql array with PHP
Date: 2001-04-02 00:34:02
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-interfacespgsql-php
I had the same problem.

I believe having an array field type in a database table doesn't help keep
atomicity of the database.

What I did was, thought about my table schema a little more. Worked out
that I can use the array field type for only storing numbers. Why? 

When I receive the row from postgres I explode it. If I was using text in
the array, it may contain "," which would then ruin the explode.

Where $row[6] is the selected array field containing only numbers.

$new_array = explode(",", ereg_replace("[{-}]", "", $row[6]));

I was talking to rasmus ages back and he said there is no support for
arrays from postgresql.

On Sat, 31 Mar 2001 darius(at)shell(dot)bourg(dot)net wrote:

> Hello All,
> I have a few array types in a table that I'd like to update/retrieve from
> PHP.  I manage to update/insert the array with a common sql statement but
> am having a tough time retrieving the data back into an array like
> form.  PHP seems to store the result of a Postgresql array as a single
> element.  Is there a simple way to retrieve Postgresql array datatypes as
> a PHP array instead of a single element?
> Thanks,
> Steve Bourg
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster

In response to


pgsql-interfaces by date

Next:From: László TiborDate: 2001-04-02 09:45:56
Subject: RE: connect to MS SQL server
Previous:From: dariusDate: 2001-04-01 01:21:25
Subject: postgresql array with PHP

pgsql-php by date

Next:From: rickfDate: 2001-04-06 00:17:56
Subject: Wildcard queries via PHP4
Previous:From: dariusDate: 2001-04-01 01:21:25
Subject: postgresql array with PHP

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group