pg.ddx.io pgsql-php@postgresql.org mailing list archive
help / color / mirror / Atom feedpostgresql array with PHP
3+ messages / 3 participants
[nested] [flat]
* postgresql array with PHP
@ 2001-04-01 01:21 darius@shell.bourg.net
2001-04-02 00:34 ` Re: [PHP] postgresql array with PHP Grant <grant@conprojan.com.au>
0 siblings, 1 reply; 3+ messages in thread
From: darius@shell.bourg.net @ 2001-04-01 01:21 UTC (permalink / raw)
To: pgsql-php; pgsql-interfaces@postgresql.org
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
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: [PHP] postgresql array with PHP
2001-04-01 01:21 postgresql array with PHP darius@shell.bourg.net
@ 2001-04-02 00:34 ` Grant <grant@conprojan.com.au>
2001-11-20 19:49 ` Re: [PHP] postgresql array with PHP Hal Davison <hal@faams.net>
0 siblings, 1 reply; 3+ messages in thread
From: Grant @ 2001-04-02 00:34 UTC (permalink / raw)
To: darius@shell.bourg.net; +Cc: pgsql-php; pgsql-interfaces@postgresql.org
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@shell.bourg.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
>
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: [PHP] postgresql array with PHP
2001-04-01 01:21 postgresql array with PHP darius@shell.bourg.net
2001-04-02 00:34 ` Re: [PHP] postgresql array with PHP Grant <grant@conprojan.com.au>
@ 2001-11-20 19:49 ` Hal Davison <hal@faams.net>
0 siblings, 0 replies; 3+ messages in thread
From: Hal Davison @ 2001-11-20 19:49 UTC (permalink / raw)
To: pgsql-interfaces@postgresql.org
Wunner why in the origional design of PostgreSQL that an array function
was not considered? Any Clue?
===========================================================
Hal Davsion Internet Petroleum Distribution
Petroleum Data Solutions,Inc. LSE Linux V1.22
6850 Myakka Valley Tr PostgreSQL 7.03 - Sun Forte - JAVA
Sarasota, Florida 34241 Phone: (941) 921-6578
http://www.faams.net eFAX: (419) 821-5999
===========================================================
On Mon, 2 Apr 2001, Grant wrote:
> 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@shell.bourg.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
> >
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2001-11-20 19:49 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-04-01 01:21 postgresql array with PHP darius@shell.bourg.net
2001-04-02 00:34 ` Grant <grant@conprojan.com.au>
2001-11-20 19:49 ` Hal Davison <hal@faams.net>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox