--- j0hncage <[EMAIL PROTECTED]> wrote:
> I'm using the following query to populate a drop down on an input
> form. In the MySQL db table column, there are occasional empty fields
> and I can get it to a single empty field on the drop down (using
> DISTINCT/ ORDER BY) but would prefer not to have any empty spaces
> (white space) on the drop down. Any ideas?
>
> $query = "SELECT DISTINCT bearing
> FROM $table
> ORDER BY bearing";
> $result = mysql_query($query);
>
> $number = mysql_numrows($result);
>
> for ($i=0; $i<$number; $i++) {
> $bearing = mysql_result($result,$i,"bearing");
> print "<option value=\"$bearing\">$bearing</option>";
>
> }
>
>
> thanks for any help,
> John
I would use:
SELECT bearing FROM $table WHERE TRIM(bearing)>'' GROUP BY bearing;
James