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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.