I'm trying to write an XML file across a local network on a mapped drive but it
seems to be more picky when I do that as opposed to writing it locally. It must
be a file as opposed to a name,value pair for Flash. This file will be used by
multiple apps.

Please forgive my nutty string manipulation. I'm new at this and have not
figured out how to do it more efficiently. I'm running PHP5 on a Windows 2000
if that makes a difference.



<?php

$dir = "X:\\";
$str_xml=array();
//set database access information as constants
DEFINE ('DB_USER', 'twist');
DEFINE ('DB_PASSWORD', 'tagny5');
DEFINE ('DB_HOST', 'localhost');
DEFINE ('DB_NAME', 'tagny_clients');

//make the connection
$dbconnect = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD) OR die ('Could not
connect to MySQL: ' . mysql_error());
if($dbconnect){
//echo "connected";
};

//select database
$db = mysql_select_db(DB_NAME) OR die ('Could not select the database: ' .
mysql_error());
if($db){
//echo ", selected";
};

//make query from table
$query = 'SELECT client FROM tagny_clients GROUP BY client';
$result = mysql_query($query);


//begin XML
//main node
$str_xml = "<sharedtypes><lists Version='1'><list Version='1' name='Client'
values='";
for ($i = 0; $i<mysql_num_rows($result); $i++){
$row = mysql_fetch_assoc($result);
//$row['subclient'];
$str_xml .= $row['client'] . ', ';
}
//close nodes
$str_xml .= "'></list></lists></sharedtypes>";
///
$str_change_case = strtolower($str_xml);
$str_find_replace = str_replace("&"," & ", $str_change_case);
$str_find_replace2 = str_replace("_"," ", $str_find_replace);
$str_ucwords = ucwords($str_find_replace2);
//////////
$filename = "tag_client_list.xml";
//echo $dir.$filename.' ';
// Let's make sure the file exists and is writable first.
if (is_writable($dir.$filename)) {
if (!$fh = fopen($filename, 'w+')) {
echo "Cannot open file ($filename)";
exit;
}
// Write $str_ucwords to our opened file.
if (fwrite($fh, $str_ucwords) === FALSE) {

echo "Cannot write to file ($filename)";
exit;
}
echo "Success, wrote ".$filename;
fclose($fh);
} else {
echo "The file $filename is not writable";
}
/////////
//fclose($fh);
//print xml
//echo $str_ucwords;
?>