Reputation: 101
this title is connected to a database that is in UTF-8 Swedish-ci
php:
$ultimo = mysql_query("SELECT * FROM videos ORDER BY id DESC LIMIT 3") or die (mysql_error());
while($row = mysql_fetch_array($ultimo, MYSQL_ASSOC)){
$title = $row['titulo'];
$url = $row['url'];
echo '<a href="HREF DB">'.$title.'</a></p>';
echo '<iframe width="240" height="155" src="https://www.youtube.com/embed/'.$url.'" frameborder="0" allowfullscreen></iframe>';
echo '</div>';
}
the problem is on the image, I want to be able to use characters like:
ç / à / á / ' / etc...
Upvotes: 1
Views: 38
Reputation: 13675
Try executing something like this before your query:
mysql_query('SET character_set_results=utf8');
mysql_query('SET names=utf8');
mysql_query('SET character_set_client=utf8');
mysql_query('SET character_set_connection=utf8');
More about character sets and collations.
To be sure that browser understands characters add a meta tag:
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
One good post from SO about UTF-8 character set.
Please note that mysql_* functions are deprecated and you should switch them with mysqli_*
Upvotes: 1
Reputation: 624
Language of UTF-8 in database should not matter when all pages use same database (at least in PHP).
Are you sure that your page is UTF-8?
Edit file in some good text editor like Notepad++ and check if .php file format is 'UTF-8 (without BOM)' [all PHP files of your site].
Did you notify web browser that your page is UTF-8 encoded? In page <head> part should be something like:
<meta charset="UTF-8">
Upvotes: 1