如何使用php将第二个数据库值添加到xml属性中


How to add a second database value into an xml attribute using php

我有一个php文件,它为数据提要创建了一个xml。我想从我的数据库中向title属性添加第二个值,但当它以以下方式尝试时,它只是一起跳过title属性al。有办法做到这一点吗?

echo '<?xml version="1.0" encoding="ISO-8859-1"?>  
<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0">  
<channel>  
<title>Piano and keyboard shop RSS feed</title>
<description>Data feed for the website</description> 
<link>http://www.pianoandkeyboardshoponline.co.uk</link>';
mysql_select_db($database_dBconn, $dBconn);
$query_products = "SELECT id, Category, Manufacturer, Model, Color, Product, GTIN, MPN, BriefDescription, LargeImage1, Stock, price, Delivery_price FROM products";
$products = mysql_query($query_products, $dBconn) or die(mysql_error());
$row_products = mysql_fetch_assoc($products);
$totalRows_products = mysql_num_rows($products);
 while ($row_products = mysql_fetch_assoc($products)){
            echo'
        <item>
            <g:id>'.$row_products[id].'</g:id>
            <title>'.$row_products[Manufacturer].''.$row_products[Model].'</title>
            more attributes 
        </item>'; 
 }
echo '</channel> 
</rss>';

欢迎任何帮助建议。

您能为我们提供您的数据库架构/表描述吗?列名等。其次,我建议您使用PDO类而不是mysql_*方法。