#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Location
    Hong Kong
    Posts
    24
    Rep Power
    0
    I have written a dicussion board program.
    Indeed,this is my first PHP/MySQL program.
    I found a bug that I have no idea how to solve it.

    If a user entered a message with a ' in it,
    the MySQL will prompt a error message.

    I am using a <textarea></textarea> in HTML

    my program can be reach at http://www.hkccm.com/msgboard/easyphpboard.phtml
    the speed maybe slow, since I am using a 9 bucks/month webhosting service.
  2. #2
  3. 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
    18
    You need to addslashes() to the text before inserting.

    $text=addslashes($text);
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Location
    Hong Kong
    Posts
    73
    Rep Power
    15
    Thanks Rod!
    it works!
    hehe

    also thanks for your Next/Prev buttons code in PHPBuilder.com
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Location
    Hong Kong
    Posts
    73
    Rep Power
    15
    ahhh, my code got another problem.....

    if I input:
    ---------------
    This is a Test
    This is a Test
    ---------------

    the output will be:
    -----------------------------
    This is a TestThis is a Test
    -----------------------------

    is there a PHP function for displaying the string correctly?
  8. #5
  9. 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
    18
    If you output it as HTML it will do that just as if you typed that in your HTML code (returns not displayed).

    You can use the HTML <PRE> tag or you can use PHP's nl2br() function which converts new lines to <br>s

Similar Threads

  1. Replies: 1
    Last Post: January 27th, 2004, 01:13 PM
  2. IE positioning bug and its solution
    By delerious in forum HTML Programming
    Replies: 3
    Last Post: December 23rd, 2003, 04:42 AM
  3. A program calling another program
    By linh in forum Visual Basic Programming
    Replies: 3
    Last Post: November 23rd, 2003, 01:42 AM
  4. Getting the program name
    By oopsi8abug in forum Perl Programming
    Replies: 2
    Last Post: November 12th, 2003, 12:54 PM
  5. Help! program that doesnt run on another computer
    By tom_meir in forum Visual Basic Programming
    Replies: 4
    Last Post: November 6th, 2003, 10:46 AM

IMN logo majestic logo threadwatch logo seochat tools logo