Query show picture

-1

I wonder if I can display an image depending on the name.

 $qr = mysql_query($sql) or die(mysql_error());
 while($exibe = mysql_fetch_array($qr)){
 echo'<div id="tabs-1">
       <p>Nome: '.$exibe["Nome"].'</p>
       <p>Morada:   '.$exibe["Morada"].'</p>
       <p>Distrito: '.$exibe["Distrito"].'</p>
       <p>Concelho: '.$exibe["Concelho"].'</p>

For example: Show me the name of a team (Real madrid) and I get him to show me the symbol of the team without touching the database.

Can I do this?

    
asked by anonymous 22.04.2014 / 13:12

1 answer

4

For example, let's suppose it is stored in Nome team / time:

echo'<img src="/imagens/'.$exibe["Nome"].'.jpg">

Then you save the image as /imagens/Real Madrid.jpg .

  

The spelling must be identical to what is in the DB, including the upper and lower case.   In a real-world case, the ideal is to normalize the names and take the spaces and accents through PHP.

    
22.04.2014 / 13:17