﻿<html>
<head>
<title></title>
</head>

<body>

<?php 
require 'scripts/connect.php';

	//здесь запрос к базе данных для получения данных о категориях товаров


	//здесь запрос к базу данных с получением данных о товарах
	$q = ("SELECT * 
   FROM alt_t INNER JOIN main ON alt_t.id_alt=main.alt WHERE (latitude>'$latitude1') && (latitude<'$latitude2') && (longitude>'$longitude1' && longitude<'$longitude2') && (energy_class>'$energy_class1' && energy_class<'$energy_class2') &&(depth>'$depth1' && depth<'$depth2') && (date>'$date1' && date<'$date2')");
	$req = mysql_query($q);

	for ($c = 0; $c < mysql_num_rows($req); $c++)	{
		$f = mysql_fetch_array($req);

		$region_code = $doc->CreateElement('region_code');
		$region_code->setAttribute("id", $f[id]);

		$numb_region = $doc-> CreateElement('numb_region');
		$numb_region-> AppendChild ($doc-> CreateTextNode($f[numb_region]));

		

		$date = $doc-> CreateElement('priceusd');
		$date-> AppendChild ($doc-> CreateTextNode($f[date]));

		

		$region_code->appendChild($numb_region);
		$region_code->appendChild($date);

		

		$region_code->appendChild($region_code);

}

	$doc->appendChild($region_code);

	$doc->formatOutput = true;
	$doc->encoding = "windows-1251";

	$filename = 'XMLpriceua.xml';

	$doc->save($filename);

	print "<br><br><a href=\"http://$shopurl/$filename\">$shopurl/$filename</a>\n";

?>

<br><br>

<form name="" action="" method="post">
<input name="act" type="hidden" value="xml">
<input type="submit" value="Сформировать файл XML">
</form>

</body>

</html>