Re: Help...
| От | scott.marlowe |
|---|---|
| Тема | Re: Help... |
| Дата | |
| Msg-id | Pine.LNX.4.33.0212161554000.24032-100000@css120.ihs.com обсуждение исходный текст |
| Ответ на | Help... ("Francisco Mosse - (Zivals)" <fmosse@zivals.com>) |
| Список | 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.
В списке pgsql-php по дате отправления: