将记录从MySql数据库加载到选择标记中

I know that this kind of topic has been discussed many times in this forum, but I tested many solutions and it didn't work for me!

I want to display a set of values from my MySql database within a tag select, here is my code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
 <head>
   <title>Envoyer une image</title>
   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
   <style type="text/css">
    label {
        display:block;
        width:150px;
        float:left;
    }
   </style>
</head>
<body>


<h1>Envoyer une image</h1>
<form enctype="multipart/form-data" action="traitement.php" method="post">
    <p>


<?php
//paramétre de connexion au serveur de base de données et nom de la base
$serveur_db = 'localhost';
$user_db = 'root';
$pass_db = '';
$base_db = 'mybase';

// 1-connexion to server
//**************************************
$connnect = mysql_connect($serveur_db, $user_db, $pass_db);
if(!$connnect){
echo 'echec serveur'; exit();
}

// 2- DB selection
//**************************************
$db = mysql_select_db($base_db);
if(!$db){
echo 'echec base'; exit();
}

// 3- Execution of the request
//**************************************
$query = "SELECT nom_pays FROM pays";
$result = mysql_query($query) or die (mysql_error());
?>

<select name="truc">
<?php
while($line = mysql_fetch_assoc($result)){
echo '<option value="'.$line['nom_pays'].'">'.$line['nom_pays'].'</option>';
}
?>
</select>

<br>
        <label for="nom">Picture1 : </label><input type="text" name="nom" id="nom" /><br />
        <label for="image">Image : </label><input type="file" name="image" id="pic1" /><br />

<label for="nom">Picture2 : </label><input type="text" name="nom" id="nom" /><br />
        <label for="image">Image : </label><input type="file" name="image" id="pic2" /><br />


<label for="nom">Picture3 : </label><input type="text" name="nom" id="nom" /><br />
        <label for="image">Image : </label><input type="file" name="image" id="pic3" /><br />

<label for="nom">Picture4 : </label><input type="text" name="nom" id="nom" /><br />
        <label for="image">Image : </label><input type="file" name="image" id="pic4" /><br />


<br>
        <label for="validation">Valider : </label><input type="submit" name="validation" id="validation" value="Envoyer" />
    </p>
</form>
</body>
</html>

I checked the parameters of connection, and they are correct, but I got a blank slect tag (with no values I mean).

What's wrong with my code? thanks in advance

I modify my code as this:

$connnect = mysqli_connect($serveur_db, $user_db, $pass_db,$base_db);
if(!$connnect){
echo 'echec serveur'; exit();
}

$result = mysqli_query($connect, 'SELECT nom_pays FROM pays');

<select name="truc">
<?php
////////---------
if(mysql_num_rows($result)==0){
//if the account doesn't exist
echo "<script>alert(\"the variable is null\")</script>"; 
}
////////---------
while($line = mysql_fetch_assoc($result)){
echo '<option value="'.$line['nom_pays'].'">'.$line['nom_pays'].'</option>';
}
print_r($result);
?>
</select>

When I execute, I got this error message:

the variable is null.