Not being able to see your code and not knowing exactly what problem you are
having I can only throw a few guesses here. If you could elaborate more on
what you are expecting and what you are getting that would be a big help.
<snip>
$country_sql = "select countryname, countryid from TBL_COUNTRY";
</snip>
You don't use the value of countryname anywhere in your statement...is it
necessary?
<snip>
if ($country_query = mssql_query($country_sql)) {
</snip>
What is this statement intended to do? Typical when a query is formed PHP
gives the query an integer id. But that ID is allocated by PHP and if you
add a new query earlier in the code later on the ID for this query will most
likely change...which then will make it not equal what you're expecting it
to equal...in this case $country_query.
Also on a further note you need to use == instead of = otherwise PHP will
assume the statement is always true.
<snip>
while ($myrow = mssql_fetch_array($country_query))
if ($country == $myrow["countryid"]) {
print "<option value=" . $myrow["countryid"] . " selected>" .
$countryid . "</option>";
} else {
print "<option value=" . $myrow["countryid"] . ">" .
$countryid . "</option>";
}
}
}
</snip>
Your while statement is missing a { ....was this code working when you used
it?
Also unless you need PHP returning the success of printing the text you're
better off using echo instead of print.
Based on what I see this code may be what you're looking for
(untested)
$country_sql = 'SELECT countryid FROM TBL_COUNTRY';
while ($myrow = mssql_fetch_row($country_query)) {
echo "<option value=$myrow[0]";
if ($country == $myrow[0]) { echo " selected>$myrow[0]</option>"; }
else { echo ">$myrow[0]</option>"; }
}
Sincerely,
Craig Vincent
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]