Inserting data from an XML file into table

Jogi

New Member
I am trying to get data from an XML file on the web into my datbase so that I can use it. I have produced the following code, but as its been a long time since I have done coding, imlost with the error message that I am getting. The error is "Unknown column '10074' in 'field list'".10074 is the produce ID of the first item in the XML file. Any pointers would be really useful as it is doing my head in!The code I have is as follows:\[code\] <?php $Products = simplexml_load_file('http://atsdistribution.co.uk/feeds/xml_all_products.aspx');$con = mysql_connect(Details);if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db("catflaps_products", $con);foreach($Products->Product as $Product){$ProductID = $Product->ProductID;$Name = $Product->Name;$DropshipPrice = $Product->DropshipPrice;$SRP = $Product->SRP;$Brand = $Product->Brand;$Xline = $Product->Xline;$InStock = $Product->InStock;$Stock = $Product->Stock;$Barcode = $Product->Barcode;$Weight = $Product->Weight;$CategoryID = $Product->CategoryID;$Category = $Product->Category;$SmallImage = $Product->SmallImage;$LargeImage = $Product->LargeImage;$Description = $Product->Description;mysql_query("INSERT INTO test(ProductID, Name, DropshipPrice, SRP, Brand, Xline, InStock, Stock, Barcode, Weight, CategoryID, Category, SmallImage, LargeImage, Description)VALUES(`$ProductID`, `$Name` , `$DropshipPrice`, `$SRP`, `$Brand`, `$Xline`, `$InStock`, `$Stock`, `$Barcode`, `$Weight`, `$CategoryID`, `$Category`, `$SmallImage`, `$LargeImage`, `$Description`)") or die(mysql_error());}mysql_close($con);?>\[/code\]
 
Back
Top