1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

What comes out won't go in!

Discussion in 'PHP' started by nfzgrld, Mar 1, 2005.

  1. #1
    I'm trying to write a cart app to replace zen-cart on my shopping site. I've got a good idea of how I want to do it. First though I need to get the data from the zen db into the new db so I have something to work with. So I wrote a little script to get the data out of the zen db, put it in an array, then INSERT into the new db.

    I'm not doing anything to the data while moving it. Both dbs are MYISAM. When I pull one particular field out I get syntax erros when I try to put it into the new db. Both fields are just simple text fields. The data is text with HTML tags. The errors returned are like this:
    You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'desc='
    Code (markup):
    Here's the query that returns it:
    	$puts = @mysql_query("UPDATE products SET desc='$desc' WHERE model='$pmodel'");
    	if(!$puts){echo mysql_error();}
    Code (markup):
    Remember, I'm not doing anything to the contents of the data while I'm moving it. Here's a sample of the data:

    <b>Description</b><br>  Add some pizzazz to your casual wardrobe with this sheath dress from Prague.     <br><br>  <b>Prague Jersey Knit Sheath Dress:</b>  <ul>  <li>Available in black or khaki colors   </li><li>92-percent nylon/8-percent spandex      </li><li>Machine wash cold  </li><li>Made in Taiwan  </li><li>Model numbers :NO:B Khaki  </li></ul>  <b>Features include: </b>  <ul>  <li>Cap sleeves  </li><li>Approximately 35 inches from shoulder to hem  </li></ul>  <i>Imported.</i><br>           <p>Dimensions: 10.00" x 9.00" x 6.00 "<br>        </p><p>Weight: 0.50<br>              </p>
    Code (markup):
    I've been looking at this for about three hours now and I just can't find any rhyme or reason for it. I'm either missing something obvious, or something funky is going on. Either way I'm at a dead stop until I can get this code into the database. :confused: I've tried just creating a csv export and then just importing that way but I get the same results. I tried using htmlspecialchars() on the string and still got the same results with and without ENT_QUOTES turned on. I'm just not seeing anything in the code or the data that would cause this. Any help will be very much appreciated.
     
    nfzgrld, Mar 1, 2005 IP
  2. nfzgrld

    nfzgrld Peon

    Messages:
    524
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Never mind. I ended up just writing out a csv and importing the data. Why it wouldn't do an insert like a normal bit of data I guess I'll never know.
     
    nfzgrld, Mar 1, 2005 IP
  3. rvarcher

    rvarcher Peon

    Messages:
    69
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    rvarcher, Mar 2, 2005 IP
    mushroom likes this.
  4. mushroom

    mushroom Peon

    Messages:
    369
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #4
    mushroom, Mar 2, 2005 IP