XML Data into my Database

priecefentuara

New Member
It has been a long time since I have been a coder and I am getting set with something I know is really simple.I am trying to access an XML Page of products and insert them into my database.The code I have produced is giving me the following error message: \[code\]Unknown column '10074' in 'field list' \[/code\]10074 is the Product ID of the first item.The code is below. Can you point me in the right direction with this as it is really getting to me.Many thanks in advance!\[code\]<?php $Products = simplexml_load_file('http://atsdistribution.co.uk/feeds/xml_all_products.aspx');$con = mysql_connect(*****);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);// some code?>\[/code\]
 
Back
Top