Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 843D7476179 for ; Mon, 16 Dec 2002 18:10:34 -0500 (EST) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by postgresql.org (Postfix) with ESMTP id 89237476799 for ; Mon, 16 Dec 2002 18:08:34 -0500 (EST) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.6/8.12.6) with ESMTP id gBGN7VEV027173; Mon, 16 Dec 2002 16:07:31 -0700 (MST) Date: Mon, 16 Dec 2002 16:02:42 -0700 (MST) From: "scott.marlowe" To: "Francisco Mosse - (Zivals)" Cc: Subject: Re: Help... In-Reply-To: <001101c2a552$34de9960$c334010a@zivals> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT X-MailBodyFilter: Message body has not been filtered X-MailScanner: Found to be clean X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/33 X-Sequence-Number: 1708 On Mon, 16 Dec 2002, Francisco Mosse - (Zivals) wrote: > Hi! > > What is wrong? My server has PHP and Postgre > I canīt understand hoy do I get this error... look > I start with a value ($quebuscototal) and I should get an array like > this ("'abc', 'def', 'ghi', 'jkl') ? > but with this code, what I receive is an array where the first element > is 'abc', 'def', 'ghi', 'jkl' instead of being 'abc' (and the second > one, 'def', the third one 'ghi', etc.) > > $quebuscototal = "abc def ghi jkl"; > $quebuscototal = str_replace(' ',' \', \'',$quebuscototal); > $quebuscototal = "'$quebuscototal'"; > $quebuscofinal = array($quebuscototal); > $quees = "$quebuscofinal[1] "; The array() construct is not a function, so it's generally used only to create arrays without variables. I'm not sure if it can handle vars inside it. There are maybe some tricks to get around this, but implode/explode are better for mucking with arrays anyway. I'll try to give a little help. $quebuscototal = "abc def ghi jkl"; $quees = explode(" ",$quebuscototal); should result in an array like this: $quees[0]="abc"; $quees[1]="def"; $quees[2]="ghi"; $quees[3]="jkl"; There are lots of fun ways to manipulate arrays in PHP, by the way. Look at explode, implode, array_pop, array_push and some of the others listed in the docs.