Jump to content

handling special characters in PHP


dub_stylee

Recommended Posts

Hello, I am running into another small (but hopefully simple) problem.  I am querying my database by album name; everything works fine except for when I encounter album names such as "Kill 'Em All" or "S&M".  I am passing the album name to a PHP script via:

 

/processalbum.php?album_name=S&M

I have also tried:

 

/processalbum.php?album_name=S&M

 

but this doesn't seem to work either.  I have a similar problem with "Kill 'Em All" because it cuts off the album name at the apostrophe.  Does anyone have any suggestions on how to handle this situation?  Thanks in advance,

 

Brian

Link to comment
https://forums.phpfreaks.com/topic/136015-handling-special-characters-in-php/
Share on other sites

<?php

$replace=preg_replace("&","&",$replace);

?>

 

 

When would he ever use that?

 

 

In a URL, & is no more valid than ?var1=val&something; would be.  & is a reserved character, straight up.  %26 is used for & in a URL because 26 is the decimal representation of the ASCII-number value of &.

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.