Hope you can help!
I am trying to get some code from XML into MYSQL but I am having a problem, the first variable Product_code is going into the MYSQL database fine however the second variable is going into the database but only showing ARRAY but it should be what is in the XML sheet
<?php
// set name of XML file
$file = "update/three_Mobile.xml";
$host = "localhost";
$user = "root";
$pass = "";
$db = "phones";
$connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!");
// select database
mysql_select_db($db) or die ("Unable to select database!");
// load file
$xml = simplexml_load_file($file) or die ("Unable to load XML file!");
foreach ($xml->xpath('//product_code') as $Product_Code) {
$Long_Name = $xml->product->product_name;
$query = "INSERT INTO deals (Dealer,Product_Code,Long_Name)
VALUES ('Three','$Product_Code','$Long_Name')";
$result = mysql_query($query) or die ("Error in query: $query. ".mysql_error());
}
mysql_close($connection);
?>
Product_Code is going into the database fine
Long_Name is only showing the value "ARRAY"
Hope you can help