我对查询结果有疑问。当我运行它时,它会批量查询所有内容。我需要从每个客户那里得到一个新的头脑。
我认为问题出在第 143 行到第 179 行。
if (!$_HTTP_POST_VARS["separator"])
$sep= str_replace('\t', "\011", $sep);
//$contents="customers_id".$sep."customers_lastname".$sep."customers_firstname".$sep."customers_email_address".$sep."customers_gender".$sep."customers_dob".$sep."entry_company".$sep."entry_street_address".$sep."entry_postcode".$sep."entry_city".$sep."entry_state".$sep."entry_suburb".$sep."countries_name".$sep."customers_telephone".$sep."customers_fax\n";
$customers_query_raw = "select c.customers_id,
c.customers_lastname,
c.customers_firstname,
c.customers_email_address,
c.customers_gender,
c.customers_dob,
c.customers_telephone,
c.customers_fax,
a.entry_company,
a.entry_street_address,
a.entry_postcode,
a.entry_city,
a.entry_state,
a.entry_suburb,
co.countries_name
from " . TABLE_CUSTOMERS . " c left join " . TABLE_ADDRESS_BOOK . " a on c.customers_id = a.customers_id and c.customers_default_address_id = a.address_book_id
left join " . TABLE_COUNTRIES . " co on co.countries_id = a.entry_country_id
WHERE c.customers_id >= 4150 and c.customers_id <= 4200";
$customers_query = tep_db_query($customers_query_raw) or die(mysql_error());
while ($row = tep_db_fetch_array($customers_query)) {
$customers_id.=$row['customers_id'];
$customers_lastname.=$row['customers_lastname'];
$customers_firstname.=$row['customers_firstname"'];
$customers_email_address.=$row['customers_email_address'];
$customers_gender.=$row['customers_gender'];
$customers_dob.=$row['customers_dob'];
$entry_company.=$row['entry_company'];
$entry_street_address.=$row['entry_street_address'];
$entry_postcode.=$row['entry_postcode'];
$entry_city.=$row['entry_city'];
$entry_state.=$row['entry_state'];
$entry_suburb.=$row['entry_suburb'];
$countries_name.=$row['countries_name'];
$customers_telephone.=$row['customers_telephone'];
$customers_fax.=$row['customers_fax'];
}
/*print('<?xml version="1.0" encoding="ISO-8859-1" ?>');*/
header("Content-type: text/html; charset=ISO-8859-1");
header("Content-disposition: attachment; filename=ordre_export_" . date("Ymd") . ".xml");
header("Content-type: application/octet-stream; charset=iso-8859-1");
echo '<?xml version="1.0" encoding="iso-8859-1"?>
<!-- -->
<Root xmlns:dt="urn:schemas-microsoft-com:datatypes">
';
echo "
<head>
<Kundenr>$customers_id</Kundenr>
<Company>$entry_company</Company>
<Kundenavn>$customers_lastname </Kundenavn>
<Adresse>$entry_street_address</Adresse>
<Adresse2> </Adresse2>
<Postnr>$entry_postcode</Postnr>
<Poststed>$entry_city</Poststed>
<Landkode> </Landkode>
<Land>$countries_name</Land>
<customers_telephone>$customers_telephone</customers_telephone>
<fax>$customers_fax</fax>
<mail>$customers_email_address</mail>
<dob>$customers_dob</dob>
<Fritekst></Fritekst>
<Kommentarer></Kommentarer>
</head>
";
$j++;
echo "
</Root>";
die();
}
require(DIR_WS_INCLUDES . 'application_bottom.php');
?>
它是如何出来的一个样本。我的客户 ID 是 4 位数字。所以它应该在 4150 之后停止并开始一个新的 XML 块。
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- -->
<Root xmlns:dt="urn:schemas-microsoft-com:datatypes">
<head>
<Kundenr>41504151415241534154415541564157415841594160416141670417</Kundenr>