#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    65
    Rep Power
    15
    I know I've asked some rather newbie and mundane questions on this list, but i think i've come up with my best yet.

    Whenever a user goes to add a message to the board, there are some cases where the message is not entered into my messages table. that case is when someone has an apostrophe in their entries ('). It can be in the subject field, which is a varchar, or the message field, which is a text.

    It may be that it's 3 AM and i'm tired.. or there could be something I'm doing wrong.

    Any help out there?

    Thanks,
    ben

    PS - did ya notice how many apostrophes i used above?
  2. #2
  3. No Profile Picture
    PHP Programmer
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Posts
    31
    Rep Power
    15
    You can use the function ereg_replace("´", "'", $str);
    to replace the character with a similar html character.

    [This message has been edited by ikaros (edited July 11, 2000).]

    [This message has been edited by ikaros (edited July 11, 2000).]
  4. #3
  5. No Profile Picture
    ads
    Guest
    Devshed Newbie (0 - 499 posts)
    You can use function addslashes() to insert data in Mysql and use stripslashes to eliminate slashes while taking out data from Mysql.

  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    65
    Rep Power
    15
    Thanks all,
    The addslashes() did exactly what I needed...
    Ben
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    59
    Rep Power
    15
    if you plan on printing it back out onto the screen you will probably have to do a stripslashes() when you do, otherwise it will print them.

    Chris
  10. #6
  11. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    19
    OK, here we go again

    You do NOT need to use stripslashes() on data originally inserted into a table with addslashes() UNLESS you also have magic_quotes on and the data was passed from one page to the next(in which case you don't need to use addslashes())
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    59
    Rep Power
    15
    Ya, I know that, I was just saying that if he tries to display his results and gets slashes then he should use stripslashes() on it before printing, just trying to save him some trouble, I didn't realize it had been covered before.

    Chris
  14. #8
  15. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    65
    Rep Power
    15
    Well, I haven't used stripslashes, and it all works and looks fine. I just needed it to add to the table... It's a another page that pulls it out,

    thanks all,
    Ben

Similar Threads

  1. Free message board hosting, 30 skins, 11 languages.
    By EDKHosting in forum Web Hosting Offers
    Replies: 1
    Last Post: October 8th, 2008, 07:26 PM
  2. Trouble with message board in php
    By chulbuli in forum PHP Development
    Replies: 1
    Last Post: November 30th, 2004, 10:25 AM
  3. simple message board using sessions
    By QuicksilverSeth in forum PHP Development
    Replies: 0
    Last Post: November 25th, 2003, 08:32 PM
  4. changing the buttons in the message box
    By crackerweb in forum Visual Basic Programming
    Replies: 6
    Last Post: October 23rd, 2003, 07:36 PM
  5. Unknown column '60A15/F/Br' in 'field list' error message
    By juanito in forum PHP Development
    Replies: 1
    Last Post: October 2nd, 2003, 10:35 AM

IMN logo majestic logo threadwatch logo seochat tools logo