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

Discussion in 'Programming' started by Glenn, Jun 7, 2013.

to remove all ads.
  1. Glenn

    Glenn Member

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

    I'm using php and MySQL
     
  2. chrishirst

    chrishirst Well-Known Member Staff Member

    Messages:
    2,670
  3. Glenn

    Glenn Member

    Messages:
    202
  4. chrishirst

    chrishirst Well-Known Member Staff Member

    Messages:
    2,670
    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.
     
  5. Glenn

    Glenn Member

    Messages:
    202
    What I mean is do I do this before it is saved in the database or after it is read out of the database.
     
  6. chrishirst

    chrishirst Well-Known Member Staff Member

    Messages:
    2,670
    What would be the point of checking data coming OUT of the database when it is INSERTING data with 'illegal' characters that causes problems?
     
  7. Glenn

    Glenn Member

    Messages:
    202
    That's what I'm asking. I do not know.
     

Share This Page