Log in

View Full Version : Upgrading from mySQL 4 to mySQL 5



kuau
05-14-2008, 06:00 PM
I just moved a site from a host with mySQL 4 to one with mySQL 5. One thing that stopped working was the ability to accept characters like apostrophes in text fields. So when users try to add events to the calendar, they get an error message if the text has even one apostrohe

Is this the correct way to fix it?


string htmlspecialchars ( string $string [, int $quote_style [, string $charset [, bool $double_encode ]]] )

This is the original code that no longer works:


<?php echo htmlspecialchars ( $description ); ?>

Or is there a better way? The host techs told me it was impossible, but this seems ludicrous to me. It is a community events calendar and the users have been able to do it no problem for 8 years (until now), with the above code. I doubt the developers would make mySQL worse as it gets older. Any ideas?

There are problems with the phpMyAdmin as well but I'll ask about that later.

Thanks in advance for your help. erin

kuau
05-15-2008, 08:04 PM
OK, I figured this one out. I just had to turn magic_quotes on in the php.ini file.

; Magic quotes for incoming GET/POST/Cookie data.
magic_quotes_gpc = On

I do understand that this has been deprecated in php6, and that it can allow SQL injection attacks, but this is just a fix until I can upgrade the underlying code to a newer version. I learned that the proper way to deal with it is to use addslashes and $POST_ variables[ ].

Hope this helps someone avoid what I just went through. erin :)

shotgun_ninja
05-16-2008, 03:46 PM
Well, this helps me. I had the same problem.

kuau
05-16-2008, 04:30 PM
Great! I guess the Subject line is rather misleading, but the hosting techs tried to tell me that any problem I was having was due to importing a version 4 database into mySQL 5. I have since learned that everything they told me was a crock and I am changing to a new host because of it. They wasted so much of my time by telling me BS. This particular problem was obviously because of a setting in the php.ini on the previous host that I didn't know about. It took all of 2 minutes to fix it once I knew what it was. erin :)