SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot
    Join Date
    Jul 2000
    Posts
    132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey guys, i really shouldn't need to know this..(should be better than that after a few months of moderate php) but I do!!!

    Right, basically, me and my mate are doing a guestbook hosting script and its coming along really nicely.

    But, the little problem i am getting at the moment, is that, when a user enters their name, if it has a --> ' <--- in it, it causes a mysql error. For example,
    My name, AJ O'Connell, causes a mysql error.

    How can I strip these for the db, and then replace them for when the name needs to be echoed?

    Thanks.
    -AJ

  2. #2
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  3. #3
    SitePoint Wizard
    Join Date
    Apr 2000
    Posts
    1,483
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Basically do addslashes($string) to remove the ' problem, and do stripslashes($string) to put them back as normal.

  4. #4
    SitePoint Zealot
    Join Date
    Jul 2000
    Posts
    132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    omg! what an idiot.
    i know that!
    cheers.
    -aj


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •