Received: from sandtstudent.pyr.ec.gc.ca (fwvan1.pyr.ec.gc.ca [199.212.20.2]) by hub.org (8.10.1/8.10.1) with ESMTP id e580LPc39380 for ; Wed, 7 Jun 2000 20:21:26 -0400 (EDT) Received: from ec.gc.ca (IDENT:huangb@sandtstudent [131.235.150.249]) by sandtstudent.pyr.ec.gc.ca (8.9.3/8.9.3) with ESMTP id RAA14798 for ; Wed, 7 Jun 2000 17:21:54 -0700 Message-ID: <393EE720.65EDA03F@ec.gc.ca> Date: Wed, 07 Jun 2000 17:21:52 -0700 From: Bernie Huang Organization: Environment Canada X-Mailer: Mozilla 4.72 [en] (X11; U; Linux 2.2.14-5.0 i686) X-Accept-Language: en MIME-Version: 1.0 To: PGSQL-SQL Subject: Fetch an element in an array Content-Type: multipart/mixed; boundary="------------37FD5845F7AFBB1471326A76" X-Archive-Number: 200006/77 This is a multi-part message in MIME format. --------------37FD5845F7AFBB1471326A76 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 7bit Hi, This is more of a PHP problem, but I wish if someone knows this can help me. How do I fetch an element in a Postgres array? I have a table like employee -------- col1 int4 col2 text[] now I used the php api $row = pg_fetch_array($exec, 0); which gives me the following: echo $row['col2']; (prints out ===> {"123-4567", "Bernie", "123-5670"} ) (echo $row['col2[2]']; <=== didn't work) What can I do to extract only the "Bernie" element? Thanks. - Bernie --------------37FD5845F7AFBB1471326A76 Content-Type: text/x-vcard; charset=iso-8859-15; name="bernie.huang.vcf" Content-Transfer-Encoding: 7bit Content-Description: Card for Bernie Huang Content-Disposition: attachment; filename="bernie.huang.vcf" begin:vcard n:Huang;Bernie tel;fax:(604)664-9195 tel;work:(604)664-9172 x-mozilla-html:TRUE org:Environment Canada;Standards and Technology Services adr:;;700-1200 West 73 Ave.;Vancouver;BC;V6P 6H9;Canada version:2.1 email;internet:bernie.huang@ec.gc.ca title:Programmer x-mozilla-cpt:;0 fn:Bernie Huang end:vcard --------------37FD5845F7AFBB1471326A76--