add/strip slashes??

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
ssand
Forum Commoner
Posts: 72
Joined: Sat Jun 22, 2002 9:25 pm
Location: Iowa

add/strip slashes??

Post by ssand »

8O
I am using addslashes() when I insert data to mysql from a form and then stripslashes when I redisplay it in the browser.

Only problem is when an apostrophe is used. It seems php is adding an additional apostrophe. Is this so it has a set of single quotes or do I need to do something different?

Also, it looks like the information in the database has a single apostrophe.

Steve
kaizix
Forum Commoner
Posts: 50
Joined: Tue Jun 18, 2002 9:16 pm
Location: california
Contact:

Post by kaizix »

if you echo out the info without using stripslashes first, does it still have the double single quote?
ssand
Forum Commoner
Posts: 72
Joined: Sat Jun 22, 2002 9:25 pm
Location: Iowa

Post by ssand »

I added the echo without stripslashes and it produced the double single quote.
But, this time the echo with stripslashes applied produced correct results!

Then, I clicked a different link and came back to the listing and it displayed 4 single qoutes for the unstripped and 2 for the stripped. 8O As I continued to click around it would sometimes display the first set of results then the last set of results.

What's with that?? The php info says magic_quotes_gpc is ON. Does that have some effect on this?

Steve
ssand
Forum Commoner
Posts: 72
Joined: Sat Jun 22, 2002 9:25 pm
Location: Iowa

Update

Post by ssand »

UPDATE

I ended up emptying the entire table and started with fresh data. Which for the time seems to be working. :D

Maybe I had some data from when I did not addslashes. Who knows?

Thanks for the help.
Post Reply