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. 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.
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.
You shouldn't have a column named DESC, or any other MySQL reserved word. http://www.htmlite.com/mysql002a.php