[thelist] Query selected

Andrew andrew at humanbehaviour.co.uk
Tue Mar 4 08:31:01 CST 2003


the query is the same only on a different page. it's not specific to a user.

I tried this but it didn't work:

function CategoryDDmenu($selected=0)
{
$Query = "SELECT City, CityID FROM city ORDER BY City";
$Result = mysql_query($Query);
if($Result){
    if(mysql_num_rows($Result) <= 0){ print "NO RESULTS FOUND!"; }
    else {
        print "<select name=\"City\">\n";
        if($selected == 0){
            print "<option value=\"0\" selected> -- SELECT AN OPTION --
</option>\n";
        }
        while($RowData = mysql_fetch_array($Result)){
            print "<option value=\"" . $RowData['CityID'] . "\"";
            if($selected == $RowData['City']){ print " selected"; }
            print ">" . $RowData['City'] . "</option>\n";
        }//END while
        print "</select>\n";
    }
} else {
    print "DATABASE QUERY ERROR!";
}//END if
}//END function CategoryDDmenu
Andrew >




More information about the thelist mailing list