Hi all. This is my first post so thanks for the help! I have a project I would like to do, but need some code to help out. I have an xml file that contains a lot of information. 16000 products. What I would like to do it to pull the information from xml file then insert it into the mysql db on my website. A few things need to be changed though. I need to combine some of the fields in the xml. For example product name in the db would be "microsoft windows" from the xml <mfg>microsoft</mfg>+<name>windows</name> is what needs to be combined. How would I combine those before inserting them into the db. Or price how to add something to a number in the xml before it is inserted in the db. example <price>10.00</price>*25% so that 12.50 is inserted into the db. Thanks
Would something like this work? If so how would I edit the price for example? $id = $prod->prod['id']; $description = $prod->name; $image = $prod->awImage; $fulldescription = $prod->desc; //insert query if(strlen($prod) > 0) { $query = mysql_query("UPDATE productfeed SET description = '$description', fulldescription = '$fulldescription', image = '$image' WHERE id = '$id'") or die(mysql_error()); if(mysql_affected_rows() == 1) Â echo $id . "has been inserted </br>"; } else{ echo "This does not work </br>"; } } Code (markup): Thanks
try using the simpleXML functions: php-dot-net/manual/en/simplexml.examples-basic.php these should get you going