Re: note 101984 modified in function.mysql-fetch-array by thiago
| From: | Daniel P. Brown | Date: | Fri, 21 Jan 2011 16:08:23 +0000 |
| Subject: | Re: note 101984 modified in function.mysql-fetch-array by thiago | ||
| References: | 1 2 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-175969@lists.php.net to get a copy of this message | ||
You don't have to remove non-English, only remove if there's no
English at all.
On Fri, Jan 21, 2011 at 11:14, <thiago@php.net> wrote:
> If you use implode() with the return value by mysql_fetch_array, if you use MYSQL_BOTH on
> parameter 2, the result is not really what you're expecting.
> For example :
> my sql database contains "Amine, Sarah, Mohamed";
>
> $array = mysql_fetch_array($resource,MYSQL_BOTH);
> or $array = mysql_fetch_array($resource);
> echo implode(" - ", $array);
>
> the result is : Amine-Amine-Sarah-Sarah-Mohamed-Mohamed
> and we expect just : Amine-Sarah-Mohamed
>
> You must use MYSQL_NUM or MYSQL_ASSOC on parameter 2 to resolve the problem.
>
> --was--
> If you use implode() with the return value by mysql_fetch_array, if you use MYSQL_BOTH on
> parameter 2, the result is not really what you're expecting.
> For example :
> my sql database contains "Amine, Sarah, Mohamed";
>
> $array = mysql_fetch_array($resource,MYSQL_BOTH);
> or $array = mysql_fetch_array($resource);
> echo implode(" - ", $array);
>
> the result is : Amine-Amine-Sarah-Sarah-Mohamed-Mohamed
> and we expect just : Amine-Sarah-Mohamed
>
> You must use MYSQL_NUM or MYSQL_ASSOC on parameter 2 to resolve the problem.
>
> --------------------------------------------------------------
>
> Si vous utilisez implode() qui prend en parametre la valeur retournée mysql_fetch_array, si
> vous mettez en 2eme parametre MYSQL_BOTH (ou rien) le resultat retourné n'est pas vraiment le
> resultat que vous attendez :
> par exemple:
>
> Ma sql database contient "Amine, Sarah, Mohamed";
>
> $array = mysql_fetch_array($resource,MYSQL_BOTH);
> or $array = mysql_fetch_array($resource);
> echo implode(" - ", $array);
>
> Le resultat affiché est : Amine-Amine-Sarah-Sarah-Mohamed-Mohamed
> alors que nous attendons : Amine-Sarah-Mohamed
>
> Vous devez utiliser MYSQL_NUM or MYSQL_ASSOC en 2eme parametre pour resoudre le probleme.
>
> http://php.net/manual/en/function.mysql-fetch-array.php
>
> --
> PHP Notes Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
</Daniel P. Brown>
Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting
(866-) 725-4321
http://www.parasane.net/