Jump to content

quotation marks problem


web_master

Recommended Posts

Hi,

 

I have a strange problem.

 

1. When I want to put a text with some quotation marks in database, I have an error message: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ...

 

2. When I use a mysql_real_escape_string() the string (text) goes into database (I see it in phpmyadmin) as quot;TXTquot; - but I can't reload it back.

 

3. When I put into database like this: quot;TXTquot; - than in phpmyadmin looks like this "TXT" - and I can reload it in format "TXT"

 

I don't understand what is the problem, why can I put a text simple in format "TXT".

 

In database I use utf-8bin collation.

 

thnx.

 

T

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/258065-quotation-marks-problem/
Share on other sites

mysql_real_escape_string() is the only thing you need to use when putting something into the database (except stripslashes() beforehand if and only if magic_quotes is enabled).

When data comes out you do not need to do anything. When displaying it you do need to use a function like htmlentities().

 

I suspect your code uses htmlentities(), htmlspecialchars(), and/or html_entity_decode() in places where it should not...

Archived

This topic is now archived and is closed to further replies.

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