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! 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? 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. 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? 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 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 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 Link to comment https://forums.phpfreaks.com/topic/214091-symbol-with-php/#findComment-1114046 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.