Good Morning,
I have written a small page that creates dropdown options from a database. It works fine until I add the DISTINCT then nothing i selected in to the dropdowns.
The ODBC is to an Access Databse, if that makes any difference.
(the $nowt==NULL is there incase I need a NULL value at some stage)
This is what I have written for the dropdowns;
<TD><P ALIGN=CENTER><SELECT TYPE="TEXT" NAME="fuel">
<OPTION VALUE="All">Any Fuel</OPTION>
<?php
define (NL,"\n");
$nowt == NULL;
/* Connecting, selecting database */
$link = odbc_connect("mydatabase","sa","","")
or die("Could not connect");
$row = odbc_exec($link,"SELECT [B]DISTINCT[/B] Cars.Fuel FROM Cars ORDER BY 'Cars.Fuel' DESC");
while(odbc_fetch_row($row))
{
$item1 = odbc_result($row,1);
print "<OPTION VALUE=";
print $item1;
print ">";
print $item1;
print "</OPTION>";
}
?></P>
</TD>
Any help would be appreciated.
Regards,
Neil.