Jump to content

html_entity_decode in SQL?


drisate

Recommended Posts

Hey guys i need to create a function that tests if the first letter is found in a table... works great for the normal abc characters but ia m having a problem taking care of the special french characters This is what i got:

 

function check_l($lettre, $categ){

if ($lettre == "a"){$str = "a, à, â";
}elseif ($lettre == "e"){$str = "e, é, è, ê";
}elseif ($lettre == "c"){$str = "c, ç";
}elseif ($lettre == "i"){$str = "i, î, ï";
}else{ $str = $lettre; }

$explode = explode (', ', $str);

foreach ($explode as $value){
	$nb = $nb + @current(@mysql_fetch_assoc(@mysql_query("SELECT count(id) FROM page where LOWER(LEFT(titre,1)) = '$value' and publier = '1' and categ='$categ'")));
}

return $nb;

}

 

The problem is that the title in the table is HTML encoded so the special character "à" for exemple would be equal to à. Now knowing that, the above LOWER(LEFT(titre,1)) would only see the first character of the HTML encoded "à" wich would be "&". How can i html_entity_decode the LOWER(LEFT(titre,1)) expression an easy and clean way? LOWER(LEFT(html_entity_decode(titre),1)) is not working ...

Link to comment
https://forums.phpfreaks.com/topic/175397-html_entity_decode-in-sql/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.