RE: [PHP-DB] array question

From: Date: Mon, 24 Jul 2000 03:31:46 +0000
Subject: RE: [PHP-DB] array question
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-1427@lists.php.net to get a copy of this message
Bernie Don't know if this answers your question but to select array elements in PHP you use: $element = $array[0][0]; hth - Jason Wong Digital View Ltd 2201 Nanyang Plaza 57 Hung To Road Kwun Tong HONG KONG Tel: +852-2861-3615 Fax: +852-2520-2987 www.digitalview.com > -----Original Message----- > From: huangb@sandtstudent.pyr.ec.gc.ca > [mailto:huangb@sandtstudent.pyr.ec.gc.ca]On Behalf Of Bernie Huang > Sent: 22 July 2000 02:28 > To: Cody Caughlan > Cc: php-db@lists.php.net > Subject: Re: [PHP-DB] array question > > > Cody Caughlan wrote: > > > uh, Am I missing something or is this just a: > > > > SELECT * FROM.... > > > > /Cody > > > > Bernie Huang wrote: > > > > > Hello, > > > > > > If I want to select all elements from Postgres array-field using PHP, > > > can I do it without fetching each element seperately? > > > > > > eg; > > > > > > tb1 > > > --------------- > > > col1 {"I","have","no","problem"} > > > > > > "Select col1[1:4] from tb1"; > > > $row= pg_fetch_array(...); > > > echo $row[col1[1]]; <----- didn't work > > > > > > and I am hoping to avoid "select col1[1], col2[2]..." Thanks. > > > > > > - Bernie > > > > > > > > ------------------------------------------------------------------------ > > > -- > > > PHP Database Mailing List (http://www.php.net/) > > > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > > > For additional commands, e-mail: php-db-help@lists.php.net > > > To contact the list administrators, e-mail: > > php-list-admin@lists.php.net > > > > -- > > Cody Caughlan -codyc@cisco.com- Cisco Systems > > Web/Database Engineer phone: (408) 525-6029 > > Enterprise Line of Business pager: (408) 951-9949 > > Thought I didn't explain my question well. "Select *..." only gives you > each field, and if there is an array of elements in that field, > it wouldn't > work for PHP as $row[field[1]], $row[field[2]], ... doesn't work. > > By the way, > > update tb1 set col1[2:4]='{"test","test1","test2"}'; > > doesn't seem to work for me. Any syntax error? Thanks again. > > > - Bernie > >

« previous php.db (#1427) next »