选择数据库后没有返回任何内容

I try to return the id_selecao with this query:

SELECT id_selecao FROM selecao WHERE nome = 'Brasil'

but nothing happens, but should return id_selecao = 3. But if I do this query:

SELECT id_selecao FROM selecao WHERE nome = ''

returns the corrects id that is id_selecao = 4.

Here is my table on databe:

id_selecao  nome
1           Portugal
2           Espanha
3           Brasil
4    
5           Portugal
6           Espanha
7           Brasil  

And heres go my php files:

initdb.php

<?php
include 'services.php';

function leFicheiroSelecoes(){
    $file_handle = fopen("selecoes.txt", "r");
    while (!feof($file_handle)) {
        $line = fgets($file_handle);

        mysql_set_charset("utf8");
        insertSelecoes($line);
    }
    fclose($file_handle);
}
leFicheiroSelecoes();
disconnect();
?>

services.php

<?php
    /* INCLUDES */
    require('config.php'); //contains the user, pass, dbname to connect and access to database
    require('database.php');

/* DATA BASE */
$db = new database($dbhost, $dbuser, $dbpass, $dbname);



function insertSelecoes($nome){
    global $db;
    $query =  "INSERT INTO selecao (nome) VALUES ('$nome');";
    $db->setQuery($query);
    $db->query();
}

function disconnect(){
    global $db;
    $db->Disconnect();
}
?>

database.php

<?php
/*
 * Classe que gere a base de dados
 */
class database{

    var $sql = "";
    var $cursor = null;
    var $resource = "";

    function database($host, $user, $password, $db_name) {
        $this->Connect($host, $user, $password, $db_name);
    }

    function Connect($host, $user, $password, $db_name) {
        $this->resource = mysql_connect($host, $user, $password) or die ('Error_connecting_to_my_sql');
        if (!$this->resource) {
            die("Problema na Conex&atilde;o com Base de Dados 1");
        }
        elseif (!mysql_select_db($db_name,$this->resource)) {
            die("Problema na Conex&atilde;o com a Base de Dados 2");
        }
    }

    function Disconnect(){
        return mysql_close($this->resource);
    }

    function query(){
        $this->cursor = mysql_query($this->sql);
        if(!$this->cursor){
            die("Problema em executar a consulta na Base de Dados".mysql_error());
            //return false;
        }
        return $this->cursor;
    }

    function setQuery($sql){
        $this->sql=$sql;
    }

    function loadResult() {
        if (!($result = $this->query())) {
            return null;
        }
        $ret = null;
        if ($row = mysql_fetch_row( $result )) {
            $ret = $row[0];
        }
        mysql_free_result( $result );
        return $ret;
    }

    function loadObjectList( $key='' ) {
        if (!($result = $this->query())) {
            return null;
        }
        $array = array();
        while ($row = mysql_fetch_object( $result )) {
            $array[] = $row;
        }
        mysql_free_result( $result );
        return $array;
    }

}

?>

I can't see where is the error, I have been looking for this hours. Can anyone help me, please.

$line = fgets($file_handle);

This will return the line, including the newline character at the end. From the documentation:

Reading ends when length-1 bytes have been read, or a newline (which is included in the return value), ...

If you want to pass that to a select query, you should cut off the newline character beforehand, such as with:

$line = trim ($line);

If that doesn't work, execute the following:

select concat ('[', nome, ']') from selecao where id_selecao = 3

to check if there's any extra stuff in the database table.

is it possible you have any leading or trailing spaces in the field? Try this:

SELECT id_selecao FROM selecao WHERE nome like '%Brasil%'

Most probably you have some whitespace around the text 'Brasil'. What you could try is to put in some wildcards around the text:

SELECT id_selecao FROM selecao WHERE nome like '%Brasil%'

Probably, that'll fix the issue.