Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inverted Comma in a URL

Status
Not open for further replies.

likelylad

IS-IT--Management
Jul 4, 2002
388
0
0
GB
I have 2 php pages.

On Page 1 there is a table listing company names.
The company name contains a hyperlink to page 2 where it brings up the company details.

The problem I have is that if the company name is like Michael Mouse's Ltd then no information is brought up.

I know the problem is the inverted comma but I do not know how the solve it. At the moment I am manually changing the name to Michael Mouses Ltd to get around the issue.

on page 1 I have
[Company_Name])."

On page 2 I have
$companyname=urldecode($_GET[companyname]);

Thanking in advance for any help received
 
can i have two lines before and after the urlencode code?

Known is handfull, Unknown is worldfull
 
I have come up with a solution that works for me.

I decided to chance the MYSQL statement.

It used to be Select * from table where companyname = $companyname

It is now Select * from table where companyname Like $companyname

I still plan on trying to figure out the original problem.
At least now I have a bit of time to investigate
 
Problems like this should be taken care of by the database's table design.

I suggest:
1. Have a company_id field in your table that is unique/indexed/autoincrement. Every company, no matter what their name is, can be accessed directly and efficiently via the ID.
2. Pass the ID and make your SQL to search for it.


Searches with LIKE should be only used for real search capability like a search form. You want to pinpoint the record here, not search.
 
You can solve the problem by following either one of these:
1. try \"$myrow[Company_Name]\" instead.
2. do htmlspecialchars()
hope this helps ...

Mike

--
Mike FN
"8 out of 10 Owners who Expressed a Preference said Their Cats Preferred Web Programmer."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top