A wrong id goes into database

I have a database with a country list. I put in a select tag the countries:

$vec = array(); 
			  $vec[0] = 1;
			  $q_countries = new query('SELECT * FROM country_list');
			  if ($q_countries->execute()) {
			 	while($country = $q_countries->results_object()){
					
					array_push($vec,$country->country_name);
				}
				
			  }
			  unset($vec[0]);
			  $country =new text_select_box('country', 'Country',$vec);

but when I select a country in the database goes a different one. U can try the site here. U have to register with fake details and after that if u go to My Account u will realize that the country is not the one that u selected.
I saw that the first 15 counties, form the list, work fine, but after that, it’s a mess.

Can someone tell me where is the mistake ?

Thank you. You saved me.

The id’s of some countries could be wrong due to modifications made in the database table.
For example, if a row, with id=16 in this case, was removed from the table, it means that your array would be corrupt. Displaying country with id=17 at offset 16 in your array.

You could solve this by using the actual id of the country as the array-index.
Eg:


$ver = array();
$q_countries = new query("SELECT id, country_name FROM country_list");
if ($q_countries->execute())
{
    while ($country = $q_countries->results_object())
    {
        $vec[ $country->id ] = $country->country_name;
    }

    $country = new text_select_box('country', 'Country', $vec);
}