a1amattyj Posted September 22, 2010 Share Posted September 22, 2010 Hello, Im getting a name from the url, for instance, index.php?name=C.-and-G The "and" is then converted to a & symbol and dashes converted to spaces. This then uses the new name "C. & G" to select a record from mysql. However, it does not recognise the & symbol, the name in mysql is "C. & G" but returns 0 records. Any ideas? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/214091-symbol-with-php/ Share on other sites More sharing options...
Adam Posted September 22, 2010 Share Posted September 22, 2010 I imagine you don't quite have the expected value for "C. & G" you think. What does a var_dump on the variable return? Quote Link to comment https://forums.phpfreaks.com/topic/214091-symbol-with-php/#findComment-1114036 Share on other sites More sharing options...
a1amattyj Posted September 22, 2010 Author Share Posted September 22, 2010 C. & G Query produced: SELECT * FROM `businesses` WHERE `company` = 'C. & G' LIMIT 1 In PHP, this returns 0 rows. In phpMyAdmin, returns 1 row. Quote Link to comment https://forums.phpfreaks.com/topic/214091-symbol-with-php/#findComment-1114037 Share on other sites More sharing options...
Adam Posted September 22, 2010 Share Posted September 22, 2010 How are you determining the rows returned, could you show the code? Quote Link to comment https://forums.phpfreaks.com/topic/214091-symbol-with-php/#findComment-1114039 Share on other sites More sharing options...
a1amattyj Posted September 22, 2010 Author Share Posted September 22, 2010 $query = mysql_query(" SELECT * FROM `businesses` WHERE `company` = '".clean_up(nice_business_name_back($_GET['id']))."' LIMIT 1") or die(mysql_error()); if(mysql_num_rows($query) != 1) { $smarty->display('header.tpl'); $smarty->display('business.not.found.tpl'); $smarty->display('footer.tpl'); exit; } clean_up(nice_business_name_back($_GET['id'] Produces: C. & G Quote Link to comment https://forums.phpfreaks.com/topic/214091-symbol-with-php/#findComment-1114041 Share on other sites More sharing options...
rwwd Posted September 22, 2010 Share Posted September 22, 2010 index.php?name=C.-and-G should be: index.php?name=C&G when in the anchor ref '&' will NOT validate but '&' will and this makes the url more friendly too Rw Quote Link to comment https://forums.phpfreaks.com/topic/214091-symbol-with-php/#findComment-1114043 Share on other sites More sharing options...
a1amattyj Posted September 22, 2010 Author Share Posted September 22, 2010 Hi, When I do this, the '&' in the url cuts off the rest of the request and therefore misses the final few letters. index.php?name=C.-and-G should be: index.php?name=C&G when in the anchor ref '&' will NOT validate but '&' will and this makes the url more friendly too Rw Quote Link to comment https://forums.phpfreaks.com/topic/214091-symbol-with-php/#findComment-1114046 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.