This is how i usually do it when i want a option selected based on a value from the database. The select/sql part is not that important, just to show the connection.
//code taking from one of my scripts
$query="SELECT tekst,header,id,DATE_FORMAT(fdato,'%d.%m.%Y') fdato,DATE_FORMAT(tdato,'%d.%m.%Y') tdato,kurssted,kurstittel
FROM aktiviteter
WHERE id=".mysql_real_escape_string($_GET['i'])." AND bnavn='".$_SESSION['bruker']."'";
$row=mysql_fetch_row(mysql_query($query));
//some other code
$sql="SELECT kurstittel
FROM kurstilbud
WHERE type='kurs' AND brukernavn='".$_SESSION['bruker']."'";
$res=mysql_query($sql);
//building the select, important part
echo "<select name=\"something\">";
while ($r=mysql_fetch_row($res))
{
echo "<option value=\"".$r[0]."\" ";
// $r[0] is the current option value to be printed
// $row[6] is the value from the database,
//if they are the same print out the selected part so this option will be selected.
if ($r[0]==$row[6]) echo "selected=\"selected\" ";
echo ">".$r[0]."</option>\n";
}
echo "</select>";