php - Escape characters appearing in MySQL -


I am taking an HTML form for production from the development (localhost) and with a problem with escape characters in the initial test Identity is the production MySQL database which does not appear in the localhost database.

I am using mysql_real_escape_string to avoid characters in the form processing file and to avoid characters in the localhost database, it is saved correctly and all you see There are exceptions or quotation marks.

Once gone into production, the form is still running correctly, but the database record has a backslash escape character in front of the apostrophe or quotation marks when the record is printed and the back zodiac is visible and This will not be acceptable.

Nothing looks except local host and production, and running different versions of MySQL (localhost 5.5.24-logs running and output 5.0.95-log running) My output There is no control over the version because it is managed by ISP, so I hope this is not a problem.

Hope this makes sense? Any help much appreciated

Its solution is using Strips () before displaying the output

 Use  $ text = "don \" t mysql_ * and instead use mysqli or PDO "; Eco TripSlash ($ text); / / It will echo without backslash  

As an alternative, you can start using the statement made, which is the best practice to deal with user input and database, Avoid all quotes that will save you the crowd and snatch backslash before displaying them.


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -