Re: [PHP-DEV] mysql_fetch_xml

2001-08-23 Thread Brian Moon

This is a very neat function.  I may be able to use it.  Having said that I
think it is best left as a userland function.

Brian Moon
--
dealnews.com, Inc.
Makers of dealnews  dealmac
http://dealnews.com/ | http://dealmac.com/


- Original Message -
From: Eliot Shepard [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, August 23, 2001 3:38 PM
Subject: [PHP-DEV] mysql_fetch_xml


 I have written a simple PHP function which returns all result rows
 associated with a mysql query as an XML document. I needed this to
 facilitate XSLT presentation of database records.

 I was thinking about reimplementing the function in C and contributing
 it to php_mysql.c. Would there be any interest in incorporating this
 into the codebase?

 Eliot


 The PHP function:

 ?php

 function mysql_fetch_xml($result) {
 // turn an mysql query result into an xml document.

 $retval = ?xml version=\1.0\ encoding=\ISO-8859-1\?;
 $retval .= result;

 while ($row = mysql_fetch_assoc($result)) {
 $retval .= row;
 while(list($key, $value) = each($row)) {
 $retval .= $key$value/$key;
 }
 $retval .= /row;
 }

 $retval .= /result;

 return $retval;
 }

 ?

 Here's a usage example:

 $rows   = mysql_query($query, $dblink);
 $xml= mysql_fetch_xml($rows);

 $parser = xslt_create();
 $xsl= join ('', file ('./present_rows.xsl'));
 xslt_process($xsl, $xml, $result);
 xslt_free($parser);

 print $result;


 --
 Eliot Shepard
 [EMAIL PROTECTED]



 --
 PHP Development Mailing List http://www.php.net/
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]





-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] mysql_fetch_xml

2001-08-23 Thread Joey Smith

I agree with Brian on this. The only way I can see it being a good idea
to have this in a module is if it were made part of the dbx extension,
or maybe a PEAR C module...

On Thu, 23 Aug 2001, Brian Moon wrote the following to Eliot Shepard :

 This is a very neat function.  I may be able to use it.  Having said that I
 think it is best left as a userland function.
 
 Brian Moon


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] mysql_fetch_xml

2001-08-23 Thread Markus Fischer

On Thu, Aug 23, 2001 at 03:17:02PM -0600, Joey Smith wrote : 
 I agree with Brian on this. The only way I can see it being a good idea
 to have this in a module is if it were made part of the dbx extension,
 or maybe a PEAR C module...

What about PEAR, no?

- Markus

-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] mysql_fetch_xml

2001-08-23 Thread Christian Stocker

In article [EMAIL PROTECTED], Joey
Smith [EMAIL PROTECTED] wrote:

 I agree with Brian on this. The only way I can see it being a good idea
 to have this in a module is if it were made part of the dbx extension,
 or maybe a PEAR C module...

There's already a sql2xml module in pear called XML_sql2xml, which uses
PEAR::DB and has some more features (so it's also more bloated, maybe :)
), but does basically the same.

chregu

-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] mysql_fetch_xml

2001-08-23 Thread Eliot Shepard

 There's already a sql2xml module in pear called XML_sql2xml, which
uses
 PEAR::DB and has some more features (so it's also more bloated, maybe
:)
 ), but does basically the same.

Ah. Had I been more aware of PEAR, I would have found this. Off-topic I
know, but is there a plan for something a la search.cpan.org for PEAR?

Thanks for the input, gentlemen.

Eliot

--
Eliot Shepard
[EMAIL PROTECTED]



-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] mysql_fetch_xml

2001-08-23 Thread Christian Stocker

In article [EMAIL PROTECTED], Eliot Shepard
[EMAIL PROTECTED] wrote:

 There's already a sql2xml module in pear called XML_sql2xml, which
 uses
 PEAR::DB and has some more features (so it's also more bloated, maybe
 :)
 ), but does basically the same.
 
 Ah. Had I been more aware of PEAR, I would have found this. Off-topic I
 know, but is there a plan for something a la search.cpan.org for PEAR?

not yet, but (hopefully) soon. Some people are working on making
pear.php.net useful ;)

chregu

-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]