Re: unique array items

From: Date: Thu, 26 Oct 2000 01:40:52 +0000
Subject: Re: unique array items
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-21998@lists.php.net to get a copy of this message
On Wed, 25 Oct 2000, Kevin Waterson wrote: > 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 I'm not sure what you mean here by 'will not accept them as variables'. If you are trying to build a drodown list, you of course need the appropriate SELECT tag info around the option and it all needs to be in a form to display correctly. -- David Robley | WEBMASTER & Mail List Admin RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/ AusEinet | http://auseinet.flinders.edu.au/ Flinders University, ADELAIDE, SOUTH AUSTRALIA

« previous php.general (#21998) next »