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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.