imperium2335 Posted July 11, 2011 Share Posted July 11, 2011 Hi, This is a problem that keeps cropping up. I know the hex code for & is %26, but what function in PHP can convert %26 into the & symbol for display purposes, and use %26 for mysql and url purposes? Link to comment https://forums.phpfreaks.com/topic/241654-the-symbol-in-mysql-queries/ Share on other sites More sharing options...
teynon Posted July 11, 2011 Share Posted July 11, 2011 The function you are specifically referring to is urlencode($string); decode using urldecode($string); However, you could also htmlspecialchars($value, ENT_QUOTES); then when you retrieve the results, use htmlspecialchars_decode($value); Link to comment https://forums.phpfreaks.com/topic/241654-the-symbol-in-mysql-queries/#findComment-1241168 Share on other sites More sharing options...
LeadingWebDev Posted July 11, 2011 Share Posted July 11, 2011 $s=''; foreach(explode("\n",trim(chunk_split($string,2))) as $h) $s.=chr(hexdec($h)); Link to comment https://forums.phpfreaks.com/topic/241654-the-symbol-in-mysql-queries/#findComment-1241235 Share on other sites More sharing options...
imperium2335 Posted July 11, 2011 Author Share Posted July 11, 2011 There is still a problem when it comes to URLs. I have Hartmann%20%26%20Braun.html in my URL, but when I use GET and echo it I just get Hartmann. Link to comment https://forums.phpfreaks.com/topic/241654-the-symbol-in-mysql-queries/#findComment-1241244 Share on other sites More sharing options...
teynon Posted July 11, 2011 Share Posted July 11, 2011 Can we see your code? Its hard to tell what you are trying to do. Link to comment https://forums.phpfreaks.com/topic/241654-the-symbol-in-mysql-queries/#findComment-1241246 Share on other sites More sharing options...
imperium2335 Posted July 11, 2011 Author Share Posted July 11, 2011 the url "manufacturer-Hartmann%20&%20Braun.html" is a rewrite which follows: RewriteRule manufacturer-results/manufacturer-(.*)\.html$ manufacturer-results.php?manufacturer=$1 But I don't think that is the problem? echo $query = $_GET['family'] ; gives me 'Hartmann' Link to comment https://forums.phpfreaks.com/topic/241654-the-symbol-in-mysql-queries/#findComment-1241275 Share on other sites More sharing options...
imperium2335 Posted August 12, 2011 Author Share Posted August 12, 2011 Does anyone have any ideas? Even with urlencoding the & symbol it still doesnt work. Link to comment https://forums.phpfreaks.com/topic/241654-the-symbol-in-mysql-queries/#findComment-1256545 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.