SitePoint Sponsor

User Tag List

Results 1 to 14 of 14

Thread: Problem Inserting into SQL Database

  1. #1
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,902
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    I've got a simple HTML form that submits basic articles into an SQL database - it works fine, except when I enter one article inparticular. It contains a few weird characters in it - however even removing them does not work.

    I find it can add data into the SQL database, but once it reaches a paragraph or two, it doesn't work anymore. It really isn't making any sense to me.

    Anyone have any ideas on what might be wrong?

  2. #2
    SitePoint Zealot
    Join Date
    May 2000
    Posts
    150
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    What is the *exact* SQL error that you receive?

    Maybe you're not escaping some of the chars like " or ? or ' etc.. ??

    Arpith

  3. #3
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,902
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    My mistake - I'm not getting any error at all. Instead, the page just sits there, taking forever to load. I've tried it on multiple computers. I wait awhile, hit stop, and once I remove a certain amount of text, it submits within a second or two.

    One of the things I wonder about is the fact that part of the form has me uploading an image - however this hasn't been a problem in the past, and I've tried this without uploading an image at all.

    It seems if I try to add more than, say, 2 paragraphs of the article, it just doesn't process - it just hangs there. Could there be some odd command in my script that's causing this? I figured I must've screwed up somewhere, but I don't see how this could be so if less text in the textarea solves the problem.

  4. #4
    Fluffy Kitten Programmer~ Elledan's Avatar
    Join Date
    Jun 2000
    Location
    Netherlands
    Posts
    1,356
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This problem only occurs with one article? You might want to give a link to it (save it as .txt) and if you could give a link (or post it here) to the script (this one too in .txt format) we could help you much faster
    www.nyanko.ws - My web-, software- and game development company.
    www.mayaposch.com - My personal site and blog.

  5. #5
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,902
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well then, of course, people would get to read the article before I release it. Not a big deal or anything. The weirdest thing is that If I take away SOME text, it works - but add a bit more, and it doesn't.

    I'm gonna try it again - hopefully SQL was just acting up.

  6. #6
    Non-Member
    Join Date
    Apr 2000
    Location
    Waco, Texas.
    Posts
    188
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What column type are you using? Maybe the article is too large for the column type you are using?

  7. #7
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,902
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Plain old TEXT - no way it's too large, I'm sure I've used much larger.

  8. #8
    Non-Member
    Join Date
    Apr 2000
    Location
    Waco, Texas.
    Posts
    188
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try using LONGTEXT, that may help?

  9. #9
    Fluffy Kitten Programmer~ Elledan's Avatar
    Join Date
    Jun 2000
    Location
    Netherlands
    Posts
    1,356
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm certain that a normal TEXT column can contain much more than just two lines of text.

    It must be something different, I think.
    www.nyanko.ws - My web-, software- and game development company.
    www.mayaposch.com - My personal site and blog.

  10. #10
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You are using MySQL right?
    A TEXT field in MySQL can hold 65535 characters easily can fit a whole page of text.

    From The MySQL manual:
    TEXT
    A BLOB or TEXT column with a maximum length of 65535 (2^16 - 1) characters. See section 7.7.1 Silent Column Specification Changes.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  11. #11
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,902
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yup, MySQL - I havn't the faintest idea of what might be wrong. I'm gonna try it on another computer or two and see if that works. I'm totally stumped for the most part, though.

  12. #12
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Have you tried

    htmlentities()

    or

    htmlspecialchars()

    On your data before inserting it.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  13. #13
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,902
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, I have not - I honestly am thinking now that the script is just fine, because I've having problems submitting forms with large amounts of text with other scripts as well - such as vBulletin, for example.

    This is likely a problem with my computer or web browser - I tried another computer, but it *IS* networked to this one.

    I'll try one seperate from the others and using a different connection tomorrow and see what happens - I think that will fix it.

  14. #14
    SitePoint Zealot
    Join Date
    May 2000
    Posts
    150
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    I had no problems submitting extremely large amounts of data into the 'blob' type column. Of course, I tested this offline in 'localhost' so the possibility of a server timeout does not come in.

    Maybe its taking too long to submit the text?

    Arpith

Bookmarks

Posting Permissions

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