I'm from Mexico, so our strings contain some special characters that need to be stored and later displayed. Is there a way (using PHP) to encode a string from MySQL and use it in html?
<?php
function especialidades($dbcesp){
$q="SELECT NombreEspecialidad FROM especialidad;";
$r=mysqli_query($dbcesp, $q);
while ($esp=mysqli_fetch_assoc($r)) {
?>
<button type="button" class="btn btn-default"><?php echo $esp['NombreEspecialidad']; ?></button>
<?php
}
}
?>
This is the way I retrieve and generate some buttons for my webpage, but for some reason, aren't displayed correctly.