Jump to content


This topic is now archived and is closed to further replies.


Chaning a Database Default Answer

Recommended Posts

I know absolutely nothing about this, but am hoping to make a minor change in a program.  I have an online auction site and when a member registers, or lists an item for the auction, one of the fields is Country.  In that spot, it says "Please Select Country".  You then choose from a list of countries, which has pretty much all the countries I could think of, plus some.  I would like to change it so that the default country is Canada.  I know the code for Canada is "32", just like the code for the USA is "210".  In the database, there is a table called "Countries" which has all the countries listed, along with their country code.  I have tried setting this to "32" for a default, but it made no difference.  I don't know if there would be another setting in there that I need to change.  In the code itself, there is some various spots, where they have put a "0" which refers to the "Please Select Category" or invalid entry.  I have tried changing the numbers in this general area around, and again it makes no difference.

I am not sure if I need to change it in the DB or if it would be in the script that I need to change it.

Here is an example of the membership form that they complete (the portion relating to country).  Not sure if that tells you anything as to where I should be looking to set the default.

              <TD width="44%" height="25" align=left valign="top" class="innertablestyle"><font  class="normal"><B>Country<br>
              <TD width="6" align=left valign="top"><font class="normal"><FONT class=red>*</font></FONT></TD>
              <TD> <SELECT name="sb_country">
                  <OPTION value=0
                          <? if($sb_country==0) {echo " selected ";}?>>Select
                  a country
                                                  $country1=mysql_query("select * from sbauctions_country order by country");
                                                  while($rst= mysql_fetch_array($country1))
                  <OPTION value=<? echo $rst["id"];?> <? if($rst["id"]==$sb_country) {echo " selected ";}?>><? echo $rst["country"];?></OPTION>
                                                          } // wend
                </SELECT> </TD>

thanks in advance,


Share this post

Link to post
Share on other sites
This is not a MySQL question.

Somewhere in your script you need to set the variable $sb_country to the value you want, then the country corresponding to that value will be selected by default in the menu.

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.