unique array items
| From: | Kevin Waterson | Date: | Wed, 25 Oct 2000 00:19:54 +0000 |
| Subject: | unique array items | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-21883@lists.php.net to get a copy of this message | ||
I need to get from an array the unique items
mysql_pconnect("localhost","$UserName","$Password") OR DIE
(mysql_error());
$result=mysql("pos","SELECT DISTINCT PayTo FROM ChequeBook");
while ($row = mysql_fetch_array($result)) {
echo "<option value=\"$row[PayTo]\">$row[PayTo]</option>";
}
the above works in as much as it shows the items in the
option value but will not accept them as variables?
if I remove the DISTINCT it works fine, but, does not
give me the unique item and lists _all_ the item.. as it should.
So what I need is to use array_unique() in some manner as to give
me the unnique items from the array create buy mysql_fetch_array()
All replies greatfully recieved
Kevin