I have the following XML and code that I try to save it in mySQL. It is working but my problem is that I can not get the product id attribute.
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'product_id' cannot be null
<product id="1111845">
<name><![CDATA[MadBiker 600]]></name>
<link>http://demo.com/p.MadBiker-600.1111845.html</link>
<price_with_vat>107.01</price_with_vat>
...
...
...
</product>
Here is the code
$xml = simplexml_load_file("demo.xml");
foreach($xml->products->product as $data) {
$sql = "INSERT INTO products (shop, product_id, name, price, shipping, manufacturer, stock, availability)
VALUES (:SHOP, :ID, :NAME, :PRICE, :SHIPPING, :MANUFACTURER, :STOCK, :AVAILABILITY)";
$stmt = $dbh->prepare($sql);
"ID" => $data->product[id] ,
"NAME" => $data->name,
"PRICE" => $data->price_with_vat,
How to do this?