What is the best way to learn how to deal with apostrophes in the database?

Glenn

Member
I know they can become a problem so I need to learn how to deal with them.

I'm using php and MySQL
 

chrishirst

Well-Known Member
Staff member
Always!


It does not matter if there are no characters that need escaping, but it DOES if you miss one.

First rule of data handling: Any and ALL user input should sanitised, cleaned and verified BEFORE using it in a query.
 

Glenn

Member
Always!


It does not matter if there are no characters that need escaping, but it DOES if you miss one.

First rule of data handling: Any and ALL user input should sanitised, cleaned and verified BEFORE using it in a query.

What I mean is do I do this before it is saved in the database or after it is read out of the database.
 

chrishirst

Well-Known Member
Staff member
What would be the point of checking data coming OUT of the database when it is INSERTING data with 'illegal' characters that causes problems?
 
Top