Jump to content

& Symbol with PHP


a1amattyj

Recommended Posts

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

$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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.