';
for($x=0;$x<4;$x++){
$n = 0;
//nav
if($x == 0){
$xml .= "";
$qry[0] = "SELECT * FROM table1";
$result = mysql_query($qry[$x]);
while($stuff = mysql_fetch_assoc($result)){
$xml .= "";
}
$xml .= "";
}
//coll
if($x == 1){
$xml .= "";
$qry[1] = "SELECT * FROM table2 group by state";
$result = mysql_query($qry[$x]);
while($stuff = mysql_fetch_assoc($result)){
$xml .= "";
$xml .= "".$stuff[state]."";
$get_locations = mysql_query("SELECT * FROM table2 WHERE state='".$stuff[state]."' group by title");
while($location_data = mysql_fetch_assoc($get_locations)){
$xml .= "";
$xml .= "".$location_data[title]."";
$get_titles = mysql_query("SELECT * FROM table2 WHERE state='".$stuff[state]."' and title='".$location_data[title]."'");
while($names = mysql_fetch_assoc($get_titles)){
$xml .= "".stripslashes($names[name])."";
$xml .= "".$names[link]."";
}
$xml .= "";
}
$xml .= "";
}
$xml .= "";
}
//news
if($x == 2){
$xml .= "";
$qry[2] = "SELECT * FROM table3";
$result = mysql_query($qry[$x]);
while($stuff = mysql_fetch_assoc($result)){
$xml .= "";
$xml .= "".stripslashes($stuff[title])."";
$xml .= "".stripslashes($stuff[description])."";
$xml .= "";
}
$xml .= "";
}
//gloss
if($x == 3){
$xml .= "";
$qry[3] = "SELECT * FROM table4";
$result = mysql_query($qry[$x]);
while($stuff = mysql_fetch_assoc($result)){
$xml .= "";
$xml .= "".stripslashes($stuff[word])."";
$xml .= "".stripslashes($stuff[definition])."";
$xml .= "";
}
$xml .= "";
}
}
$xml .= "";
echo $xml;
$myFile = "xml/data.xml";
$fh = fopen($myFile, 'w') or die("can't open file");
fwrite($fh, $xml);
fclose($fh);
?>