svetylikss
New Member
This my original XML, i want to run sql on it so i can just select one record from but, I've done it successfully, i want to get only record that i want\[code\]<catalog><product><programname>Teva Footwear</programname><programurl>http://www.teva.com?cid=aff_pr</programurl><catalogname>Teva Footwear Product Catalog</catalogname><lastupdated>03/25/2013</lastupdated><name>Teva Men Tanza Leather Sport Sandals in Brown</name><keywords>Teva Men Tanza Leather Sport Sandals in Brown</keywords><description>...</description><sku>1000183-BRN</sku><manufacturer>Teva</manufacturer><manufacturerid>1000183-BRN</manufacturerid><currency>USD</currency><saleprice>85.00</saleprice><price>85.00</price><retailprice>85.00</retailprice><fromprice>Yes</fromprice><buyurl>...</buyurl><impressionurl>http://www.awltovhc.com/image-6059025-10757671</impressionurl><imageurl>...</imageurl><advertisercategory>Men</advertisercategory><promotionaltext>Fast, Free Shipping and Free Returns!</promotionaltext><online>Yes</online><instock>YES</instock><condition>New</condition><warranty>...</warranty><standardshippingcost>0.0</standardshippingcost></product><product>...</product><product><programname>Teva Footwear</programname><programurl>http://www.teva.com?cid=aff_pr</programurl><catalogname>Teva Footwear Product Catalog</catalogname><lastupdated>03/25/2013</lastupdated><name>Teva Men Original Mush Flip Flops in Tread Black</name><keywords>Teva Men Original Mush Flip Flops in Tread Black</keywords><description>See what all the hype is about and get yourself a pair of men's Teva Original Mush sandals today! Mush is the ultimate in flip flop foot-forming comfort. The Original Mush features a thicker sole and slightly wider forefoot and heel for a more generous fit.\[/code\]This is I've done so far (of course i found code online)\[code\]<?php // ---------------- The example uses the php 5 "DOM Functions" to select specific node uding Xpath query ------------------ $doc = new DOMDocument; // Create a new dom document $doc->preserveWhiteSpace = false; // Set features $doc->formatOutput = true; // Create indents on xml $doc->Load('Teva_Footwear-Teva_Footwear_Product_Catalog.xml'); // Load the file $xpath = new DOMXPath($doc); $query = '//catalog/product/sku[. = "1000183-WAL"]'; // The xpath (starts from root node) $names = $xpath->query($query); // A list of matched elements $Output=""; foreach ($names as $node) { $Output.=$doc->saveXML($node->parentNode)."\n"; // We get the parent of "<firstname>" element (the entire "<person>" node and its children) (maybe get the parent node directly using xpath) // and use the saveXML() to convert it to string } echo $Output."<br>\n\n"; // The result echo "<hr><br><b>Below view the results as HTML content. (See also the page's HTML code):</b>\n<pre>".htmlspecialchars($Output)."</pre>"; ?>\[/code\]this is output after this code: (selected record by manufacturerid)\[code\]<product> <programname>Teva Footwear</programname> <programurl>http://www.teva.com?cid=aff_pr</programurl> <catalogname>Teva Footwear Product Catalog</catalogname> <lastupdated>03/25/2013</lastupdated> <name>Teva Men Tanza Leather Sport Sandals in Walnut</name> <keywords>Teva Men Tanza Leather Sport Sandals in Walnut</keywords> <description>Following in the footsteps of our other sports sandals (no pun intended) the Tanza Leather was built to perform. Featuring our Universal Strapping System with 3 points of adjustment as well as Shoc Pad™ technology the Tanza Leather gives you a luxurious feel without sacrificing functionality.</description> <sku>1000183-WAL</sku> <manufacturer>Teva</manufacturer> <manufacturerid>1000183-WAL</manufacturerid> <currency>USD</currency> <saleprice>85.00</saleprice> <price>85.00</price> <retailprice>85.00</retailprice> <fromprice>Yes</fromprice> <buyurl>http://www.dpbolvw.net/click-6059025-10757671?url=http%3A%2F%2Fwww.teva.com%2Fwomens-tanza-leather-feminine-sports-sandals%2F737872627089%252Cdefault%252Cpd.html</buyurl> <impressionurl>http://www.awltovhc.com/image-6059025-10757671</impressionurl> <imageurl>http://www.teva.com/on/demandware.static/Sites-TEVA-US-Site/Sites-masterCatalogTeva/default/v1364225639089/images/large/T0183-WAL_1.jpg</imageurl> <advertisercategory>Men</advertisercategory> <promotionaltext>Fast, Free Shipping and Free Returns!</promotionaltext> <online>Yes</online> <instock>YES</instock> <condition>New</condition> <warranty>Teva has a 1 year warranty against defective materials and/or workmanship</warranty> <standardshippingcost>0.0</standardshippingcost></product>\[/code\]How ever it's showing whole thing for that record what I want is something like this so i can format according to my needs. keywords in metapricedescription and photo linked by buy url something like \[code\]<a href="http://stackoverflow.com/questions/15649895/$buyurl"><img src="http://stackoverflow.com/questions/15649895/$image_url"></a>\[/code\]