Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $xml=simplexml_load_file("URL") or die("Error: Cannot create object");
- foreach ($xml->programs->products->product as $product);
- foreach ($xml->programs->products->product->product_info->price as $price);
- $insert = 'INSERT INTO BBB (price) VALUES (?)';
- $insertStmt = $dbconnection->prepare($insert);
- foreach ($product as $row) {
- $insertStmt->bind_param('s', $price);
- }
- $insertStmt->execute();
- echo "New records created successfully";
- $xml=simplexml_load_file("URL") or die("Error: Cannot create object");
- $insert = 'INSERT INTO BBB (price) VALUES (?)';
- $insertStmt = $dbconnection->prepare($insert);
- foreach ($tags as $key=>$val) {
- if ($key == "product") {
- $dcprice = $key->product_info->price;
- $productranges = $val;
- for ($i=0; $i < count($productranges); $i+=2) {
- $offset = $productranges[$i] + 1;
- $len = $productranges[$i + 1] - $offset;
- $price[] = $dcprice(array_slice($values, $offset, $len));
- }
- } $insertStmt->bind_param('s', $price);
- $insertStmt->execute();
- }
- echo "New records created successfully";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement