Patrick3002 Posted June 20, 2007 Share Posted June 20, 2007 Hi. I have a name in my DB called: !#$ The %&*! (Fuck The Bullshit) When i click that link on my page "<a href="http://lyricdbonline.com/view.php?song=!#$%20The%20%&*!%20(Fuck%20The%20Bullshit)">http://lyricdbonline.com/view.php?song=!#$%20The%20%&*!%20(Fuck%20The%20Bullshit)</a>" It has all of those weird characters in it such as !, #, $, %, &, *... And when i click it, it doesnt display any of the data that im trying to pull from the db for that name "!#$ The %&*! (Fuck The Bullshit)" because of all of those special characters. Is there anyway that i could escape those so i could use my script on that name, such as.... <?php include_once("includes/config.php"); $song=$_GET['song']; $song = mysql_real_escape_string($song); $lTable="lyrics_01"; $glInfo="SELECT * FROM $lTable WHERE song = '$song'"; $lResult=mysql_query($glInfo); $aNum=mysql_num_rows($lResult); $aI=0; while ($aI < $aNum) { $pc=mysql_result($lResult,$aI,"pc"); $artist=mysql_result($lResult,$aI,"artist"); $pBy=mysql_result($lResult,$aI,"pBy"); $email=mysql_result($lResult,$aI,"email"); $lyric=mysql_result($lResult,$aI,"lyric"); $date=mysql_result($lResult,$aI,"date"); $scount=mysql_result($lResult,$aI,"scount"); $aI++; $scount++; } $cTotal = "UPDATE $lTable SET scount = '$scount' WHERE song = '$song'"; $cResult=mysql_query($cTotal); $song = stripslashes($song); $artist = stripslashes($artist); ?> Where "!#$ The %&*! (Fuck The Bullshit)" is $song Any help is much appreciated! Quote Link to comment https://forums.phpfreaks.com/topic/56443-solved-php-escaping/ Share on other sites More sharing options...
Lumio Posted June 20, 2007 Share Posted June 20, 2007 use urlencode[/code]: <a href="song.php?song=<?php echo urlencode($song); ?>">Song</a>[code] Quote Link to comment https://forums.phpfreaks.com/topic/56443-solved-php-escaping/#findComment-278771 Share on other sites More sharing options...
Patrick3002 Posted June 20, 2007 Author Share Posted June 20, 2007 That will not work... i dont understand how to use that... Quote Link to comment https://forums.phpfreaks.com/topic/56443-solved-php-escaping/#findComment-278818 Share on other sites More sharing options...
thefortrees Posted June 20, 2007 Share Posted June 20, 2007 Read up on it - its pretty straightforward - http://us.php.net/urlencode Quote Link to comment https://forums.phpfreaks.com/topic/56443-solved-php-escaping/#findComment-278835 Share on other sites More sharing options...
Patrick3002 Posted June 20, 2007 Author Share Posted June 20, 2007 I just created a sID field for all of my songs, and then pulled the data from the DB using that sID, that way its an interger im using to pull data, rather than special characters, numbers, and letters. Thanks for the help though! Quote Link to comment https://forums.phpfreaks.com/topic/56443-solved-php-escaping/#findComment-278882 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.