I'd make another array that I can refer to and check for a value from the
original query (which with a huge array could become cumbersome, but it
doesn't look like you have will have too many duplicate names).  Every time
you come across a new value, add it to the 2nd array (if it's not new, then
don't add it), then put the pointer of the array back to the start.  Return
whether it was added or not, if it was added, then return 1 (true -- you can
display that word), or else return 0 (false -- it was already in the list
and thus has been displayed).

Of course you might not want to do this if both arrays are going to become
huge (if the first is going to be like 10000 long, but the 2nd is only 4
long then it might still be slow).  I believe there is a SQL Query that can
cancel out duplicates for you.

"Ed Lazor" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> You can refer to fields by their number.
>
> $Row[3];
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 10, 2002 10:40 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] SQL field problem
>
>
> Hello
>
> I have a problem with mysql.I create a table with a field "kat".In this
> field are entries like this :
>
> Light
> Dark
> Dark
> Light
> Robot
> Find
> Dark
> Light
>
> You see that all entries are not unique.So i want to list as output all
> entries but only once.If the word "Dark" is in the table 6 times php
should
> output dark only 1 time.
> How should i solve this problem ?
>
> Thanks!
> chris
>
>
****************************************************************************
> This message is intended for the sole use of the individual and entity to
> whom it is addressed, and may contain information that is privileged,
> confidential and exempt from disclosure under applicable law.  If you are
> not the intended addressee, nor authorized to receive for the intended
> addressee, you are hereby notified that you may not use, copy, disclose or
> distribute to anyone the message or any information contained in the
> message.  If you have received this message in error, please immediately
> advise the sender by reply email and delete the message.  Thank you very
> much.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to