PHP/MySQL/XML

From: Date: Mon, 01 Apr 2002 19:33:09 +0000
Subject: PHP/MySQL/XML
Groups: php.general 
Request: Send a blank email to php-general+get-91003@lists.php.net to get a copy of this message
I have created a database called friends with four columns: Name / Address / City / State I also made an XML file to coincide with those variables: <test>
        <contacts>
                <friends>
                        <name>Friend 1</name>
                        <address>999 Foo Avenue</address>
                        <city>Foo Town</city>
                        <state>FO</state>
                </friends>
        </contacts>
</test> The variables in the XML doc above are already in the database BUT - what I want to do - using PHP and MySQL - is something like this: $connection = mysql_connect("localhost", "foo", "bar") or die ("Could not connect to server."); $db = mysql_select_db("friends") or die ("Could not select database."); $sql = "select * from friends order by name asc"; $sql_result = mysql_query($sql, $connection) or die ("Could not execute query."); echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"; echo "<?xml-stylesheet type=\"text/xsl\" href=\"friends.xsl\"?>\n\n"; echo "<test>\n"; echo "\t<contacts>\n"; echo "\t\t<friends>\n"; echo "\t\t\t<name>"; echo "$name"; echo "\t\t\t</name>\n"; echo "\t\t\t<address>"; echo "$address"; echo "\t\t\t</address>\n"; echo "\t\t\t<city>"; echo "$city"; echo "\t\t\t</city>\n" echo "\t\t\t<state>"; echo "$home"; echo "\t\t\t</state>\n"; echo "\t\t</friends>"; echo "\t</contacts>"; echo "</test>"; ?> Can this be done and am I going about it the right way? 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


« previous php.general (#91003) next »