Announcement

Collapse
No announcement yet.

Um.. Apostrophes and PHP..

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Um.. Apostrophes and PHP..

    Um.. Apostrophes and PHP..

    I use ashnews

    and recently in my new host when I submit something with an apostrophe it gives me a mysql connect error, but when I put a \ in front it goes through.. ex

    He's a good fella.
    Will not go through..

    He \ ' s a good fella.
    Will go through.

  • #2
    either make sure magic_quotes is on or you can use addslashes() I believe.

    Comment


    • #3
      Thanks alot

      Everytime I submitted something with an apostrophe, i'd get a mysql cannot connect error. A friend of mine told me how to fix it..

      <?php
      $textarea = addslashes($textarea);
      ?>

      Comment


      • #4
        Originally posted by scoutt
        either make sure magic_quotes is on or you can use addslashes() I believe.
        magic quotes always does the trick for me.

        i think one time it didnt work, so it was easily fixed, would u recommend turning them off and always using addslashes, for compatibility?

        Comment


        • #5
          I really don't think it matters. for safe gaurd you should use addslashes all the time, but all it depends on how you want to code.
          in my opinion if you write a program that is going to go to a lot of people than I would use addslashes, as it is hard to tell if everyone will have magic_quotes on.

          Comment

          Loading...
          Working...
          X