Note that there are some explanatory texts on larger screens.

plurals
  1. POremoving characters from php output in xml
    primarykey
    data
    text
    <p>I have written a xml/php document that is pulling from a Magento Commerce database, to create the XML document with all of the items in it, so that Google's Shopping can import the items. Google's system is getting hung up on a item, I believe that this is due to the special characters. I want to strip those characters out of the output. Notice in the output that there is a couple of registered trademarks, and some quotes, and commas. I doubt the quotes or commas are the problem, I think it may be the trademarks. </p> <p>Here is the output</p> <pre><code>&lt;title&gt;The FoamZall - Spray Foam Insulation Trimming Foam Saw - w/ Open Cell Blade&lt;/title&gt; &lt;description&gt;The FOAMZALL includes the toughest Milwaukee® brand heavy-duty orbital Sawzall® around, which has a custom coupling to secure a 36" long serrated blade intended for trimming 1/2 lb and 2 LB foam. The 13 Amp, 120 Vac saw has a 1 1/4" stroke and can provide up to 3,000 strokes per minute. Carry case is included. &lt;/description&gt; &lt;g:google_product_category&gt;Business &amp;amp; Industrial &amp;gt; Construction&lt;/g:google_product_category&gt; &lt;g:product_type&gt;Spray Foam Parts &amp;amp; Supplies &amp;gt; Fusion AP Parts&lt;/g:product_type&gt; &lt;link&gt;http://sprayfoamsys.com/store/the-foamzall-spray-foam-insulation-trimming-saw-open-cell-blade.html&lt;/link&gt; &lt;g:image_link&gt;http://sprayfoamsys.com/store/media/catalog/product/f/o/foamzall.jpg&lt;/g:image_link&gt; &lt;g:condition&gt;new&lt;/g:condition&gt; &lt;g:availability&gt;in stock&lt;/g:availability&gt; &lt;g:price&gt;425.0000&lt;/g:price&gt; &lt;g:brand&gt;&lt;/g:brand&gt; &lt;g:mpn&gt;&lt;/g:mpn&gt; &lt;/item&gt; &lt;item&gt; </code></pre> <p>My Script is:</p> <pre><code>&lt;?php echo '&lt;?xml version="1.0" ?&gt;'; ?&gt; &lt;rss version="2.0" xmlns:g="http://base.google.com/ns/1.0" xmlns:c="http://www.base.google.com/cns/1.0"&gt; &lt;channel&gt; &lt;title&gt;Spray Foam Systems&lt;/title&gt; &lt;link&gt;http://www.sprayfoamsys.com/store/&lt;/link&gt; &lt;description&gt;Spray Foam Rigs, Spray Foam Equipment, Sprayfoam Parts and Supplies.&lt;/description&gt; &lt;?php $con = mysql_connect(REMOVED) or die(mysql_error()); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("sprayfoa_store", $con); $query = mysql_query("SELECT * FROM `catalog_product_flat_1` WHERE `visibility` = 4 ORDER BY entity_id asc") or die(mysql_error()); ?&gt; &lt;?php while($row = mysql_fetch_array($query)) { ?&gt; &lt;item&gt; &lt;g:id&gt;&lt;?php echo $row['entity_id']; ?&gt;&lt;/g:id&gt; &lt;title&gt;&lt;?php echo $row['name']; ?&gt;&lt;/title&gt; &lt;description&gt;&lt;?php echo (str_replace(array("\r\n", "\n"), ' ', $row['short_description'])); ?&gt;&lt;/description&gt; &lt;g:google_product_category&gt;Business &amp;amp; Industrial &amp;gt; Construction&lt;/g:google_product_category&gt; &lt;g:product_type&gt;Spray Foam Parts &amp;amp; Supplies &amp;gt; Fusion AP Parts&lt;/g:product_type&gt; &lt;link&gt;http://sprayfoamsys.com/store/&lt;?php echo $row['url_path']; ?&gt;&lt;/link&gt; &lt;g:image_link&gt;http://sprayfoamsys.com/store/media/catalog/product&lt;?php echo $row['small_image']; ?&gt;&lt;/g:image_link&gt; &lt;g:condition&gt;new&lt;/g:condition&gt; &lt;g:availability&gt;in stock&lt;/g:availability&gt; &lt;g:price&gt;&lt;?php echo $row['price']; ?&gt;&lt;/g:price&gt; &lt;g:brand&gt;&lt;?php $entity_id = $row['entity_id']; $query2 = mysql_query("SELECT * FROM `catalog_product_entity_varchar` WHERE entity_id = '$entity_id' AND attribute_id = '127'") or die(mysql_error()); while($row2 = mysql_fetch_array($query2)) { echo $row2['value']; } ?&gt;&lt;/g:brand&gt; &lt;g:mpn&gt;&lt;?php echo $row['sku']; ?&gt;&lt;/g:mpn&gt; &lt;/item&gt; &lt;?php } mysql_close($con); ?&gt; &lt;/channel&gt; &lt;/rss&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload