SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Zealot
    Join Date
    Jan 2002
    Posts
    131
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    A perplexing problem concerning inputting info from a text box to a DB

    I have this code which allows me to add articles to a MySql database and it was all working great untill my host updated everything.

    Now what I find baffling is that this text;
    "the quick brown fox jumped over hte lazy dog., sdjhfsiud sgag sdg sdagsd gds agdsagd sd gsg sa gdsa g sd g ds g sd gsd ag sd gd sgd g sga gsdagsdgdsagsdagsg
    the quick brown fox jumped over hte lazy dog., sdjhfsiud sgag sdg sdagsd gds agdsagd sd gsg sa gdsa g sd g ds g sd gsd ag sd gd sgd g sga gsdagsdgdsagsdagsg"

    Can be added succesfully however this text;
    "Historically, the first two world wars both saw Germany's ascention as an economic and military superpower. Barely ten years after the reunification of Germany, the German nation stands poised as one of the strongest economies in Europe today."

    Simply wont.

    I know I haven't given you alot of info but ask and I'll tell. Hopefully you can work it out from the text?
    Any ideas?

  2. #2
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ...Germany's...
    Most likely, the ' is the problem (not Germany)

  3. #3
    SitePoint Zealot
    Join Date
    Jan 2002
    Posts
    131
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah yes thanks that would be the problem, any work arounds?

  4. #4
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    use addslashes() before inserting the text into the db. Example:
    PHP Code:
    $text="dasdfs sadfdf adfsd'fads sadfas";
    $text addslashes($text); 
    Sketch
    Last edited by Sketch; Jul 5, 2002 at 03:38.
    Aaron Brazell
    Technosailor



  5. #5
    SitePoint Wizard silver trophy TheOriginalH's Avatar
    Join Date
    Aug 2000
    Location
    Thailand
    Posts
    4,810
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    ~The Artist Latterly Known as Crazy Hamster~
    922ee590a26bd62eb9b33cf2877a00df
    Currently delving into Django, GIT & CentOS

  6. #6
    SitePoint Zealot
    Join Date
    Jan 2002
    Posts
    131
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay, this is what I've got so far but it still wont let me submit it.

    Code:
    If ($submit)
    {
    		$Comments = addslashes($Comments);
    
    		$sql = "INSERT INTO eea (Type,Headline,Description,Comments,Name,Date)
    		VALUES ('$Type','$Headline','$Description','$Comments','$Name',now())";
    		$result = mysql_query($sql);
    			
    }
    Any help?


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
  •