• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

passing characters in URL

New Here ,
Aug 30, 2007 Aug 30, 2007

Copy link to clipboard

Copied

Hi all

Was just wondering if there is any way of getting past passing specific characters in the URL..

On my music website I have found that if a song has # or & or ( or ' in the title, the link will not work...

for example if you navigate to the release named funeral on the link below, and click any song with the # symbol in the title it wont work..



heres the link linky

many thanks
TOPICS
Advanced techniques

Views

421

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Guide , Aug 30, 2007 Aug 30, 2007
You should use URLEncodedFormat() to properly encode the variables in the link

> WHERE song_sng.id_sng=#id_sng.id_sng#

The error seems to occur on this line. If #id_sng.id_sng# is a string, you should use single quotes around the value or use cfqueryparam

WHERE song_sng.id_sng= '#id_sng.id_sng#'

Votes

Translate

Translate
Guide ,
Aug 30, 2007 Aug 30, 2007

Copy link to clipboard

Copied

You should use URLEncodedFormat() to properly encode the variables in the link

> WHERE song_sng.id_sng=#id_sng.id_sng#

The error seems to occur on this line. If #id_sng.id_sng# is a string, you should use single quotes around the value or use cfqueryparam

WHERE song_sng.id_sng= '#id_sng.id_sng#'

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 31, 2007 Aug 31, 2007

Copy link to clipboard

Copied

hi there...

when i use URLEncodedFormat() to encode the variables in the link, i get an error message on the page...

and when i use single quotes around the value, the page shows, but theres no info on the page...

if you click on any song under record "funeral"...with # in the title, you will see that no info appears on the page..


http://www.musicexplained.net/a/home.cfm?a=arcade+fire

cheers

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Aug 31, 2007 Aug 31, 2007

Copy link to clipboard

Copied

> i get an error message on the page...

What is the error message? It works fine with a title like "Neighborhood #1 (tunnels)".

> the page shows, but theres no info on the page...

That's probably because you're not using URLEncodedFormat. Parameter values (with # signs, spaces, etc) may not be pass correctly if they aren't properly encoded.

In any case a better method is to pass the song id, not the title. For example, if your table contains two columns:

SongID , SongTitle
22, Neighborhood #1 (tunnels)

You should pass the ID (22) as url parameter.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 31, 2007 Aug 31, 2007

Copy link to clipboard

Copied

ok...just on my way out, thanks for this, will have a go and get back to you...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 19, 2007 Sep 19, 2007

Copy link to clipboard

Copied

LATEST
worked like an absolute charm...

brilliant

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation