I cannot select the distinct records but Im pretty sure im connected to the database. Please tell me what's wrong with this? and why I cannot see the query result?
thanks!
thanks!
Code:
echo "Status:";
$res=mssql_query("SELECT distinct(contactmethod) FROM users with(nolock)");
if(mssql_num_rows($res)==0){
echo "there is no data in table..";
} else {
echo '<select name="status" id="contactmethod >';
for($i=0;$i<mssql_num_rows($res);$i++) {
$row=mssql_fetch_assoc($res);
echo"<option value=\"$row[contactmethod]\" ";
if($contactmethod==$row[contactmethod])
echo "selected";
echo ">$row[contactmethod]</option>";
}
echo "</select><font size='+2' color ='red'>*</font> ";
}
Comment