Results 1 to 2 of 2

Thread: Storing 200Kb of data in a MySQL field

  1. #1
    Join Date
    Mar 2003
    Posts
    1

    Storing 200Kb of data in a MySQL field

    Hi, I tried to store +/- 200 Kb of data in a MySQL database. The data contains lots of unreadable characters (Like when you open a .exe file in a text-editor).
    The database doesn't give any error when I try to save it, but when I try to load the data, that datafield is empty.
    First, I thought, maybe MySQL can't save 200 Kb but then I converted every character in the data to it's ASCII value.
    To my biggest surprise, that worked! When I loaded the data, converted the ASCII values to it's original characters and asked the program if the data was still the same, it came to the conclusion indeed the data was still correct.
    So indeed, I found a sollution for that problem, but still I wonder why MySQL doesn't save the data in its string form (The fieldtypes I used were longtext and longblob).
    If somebody out there knows how I can save the data in its string form, please let me know!
    Thx!!!

  2. #2
    Join Date
    Dec 2002
    Location
    Cape Town, South Africa
    Posts
    75
    Inserting binary data often causes problems because the binary data can often break the query. You need to make sure the data is escaped (using addslashes() for example) before you insert it. Perhaps this article can help.

Posting Permissions

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