Database => XML

From: Date: Tue, 03 Oct 2000 13:46:08 +0000
Subject: Database => XML
Groups: php.dev 
Request: Send a blank email to php-dev+get-34153@lists.php.net to get a copy of this message
Dear Sir / Madam, I am a student working at TeleCats BV in the Netherlands. The project I am working on right now has to do with XML. The company wants me to read records from an MS Access database and put htese in a XML file (just like with HTML (I use Apache Cocoon XML Server)), which will be translated to HTML, WML or VXML bymeans of XSL. The problem is the first part. To read the records and put them in a XML file. Below is an example of how our XML-file looks: <?xml version="1.0"?> <?xml-stylesheet href="rooster.xsl" type="text/xsl"?> <?cocoon-process type="xslt"?> <?php Include("db.php"); $dbcart = new db; $dbcart->init("odbc"); $dbcart->open("rooster","localhost","",""); $query="SELECT * FROM Rooster; $dbcart->query($query); ?> <programma> <?php while($dbcart->getrow()) { $ps = $dbcart->field(1); $datum = $dbcart->field(2); $sport1 = $dbcart->field(3); $sport2 = $dbcart->field(4); ?> <dag> <ps><?php echo $ps; ?></ps> <datum><?php echo $datum; ?></datum> <sport1><?php echo $sport1; ?></sport1> <sport2><?php echo $sport2; ?></sport2> </dag> <?php } $dbcart->close(); ?> </programma> The first line indicates that it is an XML-file. The second line associates the stylesheet with it. The third line indicates that Cocoon should handle the XML-file. 'db.php' makes the connection to the database 'rooster'. When we request the XML-page in a webbrowser the HTML-code (generated by the XSL-file) is presented to me, but without the values ($datum, $sport1, etc.). Is there a solution to this problem? Can PHP 4.02 read records from a database from within a XML-file and translate them by means of XSL? I hope you can help me with this problem and am looking forward to your reaction! Yours Sincerely, Martin Bouman, TeleCats BV (Netherlands) P.s: I have enclosed all the files described above. <<db.php>> <<rooster.mdb>> <<rooster.xsl>> <<roosters.xml>>

Attachment: [application/octet-stream] db.php
Attachment: [application/octet-stream] rooster.mdb
Attachment: [application/octet-stream] rooster.xsl
Attachment: [application/octet-stream] roosters.xml
« previous php.dev (#34153) next »