problems inserting data into database w/ php

Discussion in 'PHP' started by cckid, Jul 29, 2007.

  1. #1
    Hi everyone,
    I'm a bit stumped and would like your input.
    I'm using a scraper to gather data from a certain website and I want to put this data into a database that I've made.
    The scrape works well, and I can output the text to the screen with no problems.
    The problem I'm having is once I insert the data into the DB, it gets inserted with some junk. For example, the phrase "cckid is awesome" would be inserted as "cckid&#32is&#32awesome". I've tried using stripslashes() and addslashes() but neither did the trick. :confused:
    Could someone help me out?
    Thanks!!:D
     
    cckid, Jul 29, 2007 IP
  2. Vangs

    Vangs Peon

    Messages:
    8
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    It looks to be converting characters to their HTML equivalents, check the source of the text printed to the screen, it could be coming from your scraping. You could always just use str_replace on the &#32's to replace them with a space.
     
    Vangs, Jul 29, 2007 IP
    Katy likes this.
  3. cckid

    cckid Peon

    Messages:
    139
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks! By looking at the source I was able to figure out what was happening. Sometimes I forget that the source of page can be quite informative when troubleshooting!
    :cool:
     
    cckid, Jul 29, 2007 IP