php get data from mysql

Discussion in 'PHP' started by seosemguy, Jul 8, 2011.

  1. #1
    Hello.
    I use a text box to insert data to mysql.
    The box is secured with the following:
    mysql_real_escape_string(stripslashes(trim(htmlent ities(strip_tags( $_POST['text_box'] )))));
    When i type in tʰe it stores it into the database but when showing,it appears:
    "& # 6 8 8 ;" ( with no space beetween letters because here it shows correctly if i have no space)


    where is the solution?
     
    seosemguy, Jul 8, 2011 IP
  2. AdsMakeSense

    AdsMakeSense Active Member

    Messages:
    389
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    70
    #2
    You are free to use HTML entities which can prevent some injection attempts.
    Of course, you should not allow it if this is for user login/password.
     
    AdsMakeSense, Jul 9, 2011 IP
  3. akshat.gl

    akshat.gl Member

    Messages:
    85
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #3
    try using htmlspecialchars instead of htmlentities, it gives a more user-friendly output. I am on cell phone so cant give a link rite now. bt it's clearly given on PHP manual.
     
    akshat.gl, Jul 9, 2011 IP