| From: | "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com> |
|---|---|
| To: | "Francisco Mosse - (Zivals)" <fmosse(at)zivals(dot)com> |
| Cc: | <pgsql-php(at)postgresql(dot)org> |
| Subject: | Re: Help... |
| Date: | 2002-12-16 23:02:42 |
| Message-ID: | Pine.LNX.4.33.0212161554000.24032-100000@css120.ihs.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-php |
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.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Jesus Rios | 2002-12-18 18:42:52 | problems when i try to connect to my Databasse |
| Previous Message | Bret Hughes | 2002-12-16 22:57:07 | [Fwd: Re: Help...] |