I have got a string ($string)
from which I extract the username for querying  mysql database.
I am using the php explode function like the code below.
( $number is the total number of id in the string).
For each loop I get the username of Mysql database but 
the problem is that my query doesn't accept it.
For example, I get Marta  (shown on my display from echo $usercut) but the $query doesn't work and I don't get the 
echo $row['email'];.
The funny thing is that if I change $usercut
typing the string "Marta" 
$usercut= "Marta"; it works!!!!!! and I get the echo $row['email'];.... It is something that makes me mad...
Does someone know if the php explode function add some hidden character to the string?
<?php
$string = "<tr id='0r'>Marta</tr0r><tr id='1r'>Paolo</tr1r><tr id='2r'>Carlo</tr2r><tr id='3r'>Esther</tr3r><tr id='4r'>Franceso</tr4r><tr id='5r'>Charles</tr5r>";
str_replace("id=","id=",$string,$number);
for($i=0; $i<= $number; $i++)
{
     $start = "<tr id='".$i."r'>";
     $end = "<\/tr".$i."r>";
     $startHadCut = explode($start, $string) ;
     $endHadCut = explode($end,$startHadCut[1]);    
    echo   $usercut = $endHadCut [0];
$query = "SELECT * FROM `Database` WHERE username = '".mysqli_real_escape_string($link, $usercut)."' LIMIT 1";   
        $row = mysqli_fetch_array(mysqli_query($link, $query));
        echo $row['email'];
}
?>
 
     
    