Re: unique array items

From: Date: Thu, 26 Oct 2000 02:04:12 +0000
Subject: Re: unique array items
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-22006@lists.php.net to get a copy of this message
David Robley wrote: > > 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>"; > > } > > 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. yes, this is a code exept and the full code has a form and the required <select></select>. all works well _exept_ if I use DISTINCT. So what I am looking for is a method to use array_unique() with mysql_fetch_array() to supply the unique items in the array. -- Kind regards Kevin Waterson

« previous php.general (#22006) next »