Ok....Thanks to all those who are helping me (sorry for cross-posting)...
My scripts are working great except for one thing....when it queries the db
there are some fields that have a NULL value, thus when it writes the XML
file it does this:
<null_field></null_field>
What I would like to do is either place an in the XML tags for all
of these NULL fields - can I do an if / else statement in the code I am
using below??
$phone_list = fopen("/usr/local/apache2/htdocs/test/phone_list.xml", "w+");
fwrite($phone_list, "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n");
fwrite($phone_list, "<?xml-stylesheet type=\"text/xsl\"
href=\"phone_list.xsl\"?>\n\n");
fwrite($phone_list, "<test>\n");
fwrite($phone_list, "\t<phone_list>\n");
while ($row = mysql_fetch_array($sql_result))
{
$name = $row["name"];
$ext = $row["ext"];
$title = $row["title"];
$home = $row["home"];
$pager = $row["pager"];
$cell = $row["cell"];
$email = $row["email"];
fwrite($phone_list, "\t\t<employee>\n");
fwrite($phone_list, "\t\t\t<name>");
fwrite($phone_list, "$name");
fwrite($phone_list, "</name>\n");
fwrite($phone_list, "\t\t\t<ext>");
// would need an if / else statement here
fwrite($phone_list, "$ext");
// end if / else statement here
fwrite($phone_list, "</ext>\n");
}
fwrite($phone_list, "\t</phone_list>\n");
fwrite($phone_list, "</test>");
fclose($phone_list);
?>
Should you have any questions, comments or concerns, feel free to call me
at 318-338-2034.
Thank you for your time,
Jay Fitzgerald, Design Director - CSBW-A, CPW-A, CWD-A, CEMS-A
==========================================================
Bayou Internet..............(888)
30-BAYOU........................http://www.bayou.com
Mississippi Internet.......(800)
MISSISSIPPI...............http://www.mississippi.net
Vicksburg Online..........(800)
MISSISSIPPI................http://www.vicksburg.com
==========================================================
Tel: (318) 338-2034 ICQ: 38823829 Fax:
(318) 323-5053
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php