www.webdeveloper.com
Results 1 to 2 of 2

Thread: Problem displaying information from database with double apostrophes

  1. #1
    Join Date
    Apr 2009
    Posts
    346

    Problem displaying information from database with double apostrophes

    I have a form which needs to accept the size of an item. The input should be done as: 12" x 15". I pass this info through a "cleaning" function and then insert it into the database. In the database, it's a VARCHAR(30) and I see the info there. But when I pull this field from the database and display it, it shows as only 12. Everything after the double apostrophe is blank.

    My real confusion comes in when I type the exact same thing into other text fields and it's displayed perfectly fine.

    Am I missing something obvious here?

  2. #2
    Join Date
    Nov 2006
    Location
    Oakland
    Posts
    500
    If you look at the HTML of page after pulling the field from the database, you will see that all the info is in the value of that field. If your field's value is between single quotes (e.g value='...') then those quotes will interfere with the apostrophe in your text.
    You might want to encode special characters by using the PHP function htmlspecialchars ($string)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles