Re: Print array items only once
| From: | sean at networkdata dot co dot uk | Date: | Wed, 09 May 2001 10:21:33 +0000 |
| Subject: | Re: Print array items only once | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-52061@lists.php.net to get a copy of this message | ||
Thanks very much Nicholas,
Sean.
""Nicolas Guilhot"" <nguilhot@gphy.campus.univ-poitiers.fr> wrote in
message
news:NEBBLNMCKLOGFKNONHDAKEIFCCAA.nguilhot@gphy.campus.univ-poitiers.fr...
> You can try to modify your SQL query and add the "DISTINCT" statement !!
It
> will return each distinct row only once.
>
> example "SELECT DISTINCT cat_id, cat_name FROM categories"
>
> Regards,
>
> Nicolas
>
> -----Message d'origine-----
> De : sean@networkdata.co.uk [mailto:sean@networkdata.co.uk]
> Envoyé : mercredi 9 mai 2001 12:02
> À : php-general@lists.php.net
> Objet : [PHP] Print array items only once
>
>
> Hi all,
>
> I am querying the categories field in my database to rurn the various
> categories that can be clicked on.
>
> Problem is, if I have 5 items in a category, my categories query lists the
> category 5 times..
>
> I am trying to work out how to say:
>
> while($qry = mysql_fetch_array($res)){
> print $res["category"]; but only once for this results array.
> }
>
> Can you help with this?
>
> Many thanks.
>
> Sean.
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>