example2.php
作者:bea
example2.php <?phpinclude_once("XML/sql2xml.php");$sql2xmlclass = new xml_sql2xml("mysql://username:password@localhost/xmltest");$xmlstring = $sql2xmlclass->getxml("select * from bands left join albums on bands.id = bandsID");?>输出
example2.php
<?php
include_once("XML/sql2xml.php");
$sql2xmlclass = new xml_sql2xml("mysql://username:password@localhost/xmltest");
$xmlstring = $sql2xmlclass->getxml("select * from bands left join albums on bands.id = bandsID");
?>
输出结果
$xmlstring = '
<?xml version="1.0"?>
<root>
<result>
<row>
<id>1</id>
<name>The Blabbers</name>
<birth_year>1998</birth_year>
<birth_place>London</birth_place>
<genre>Rock'n'Roll</genre>
<row>
<id>1</id>
<bandsID>1</bandsID>
<title>BlaBla</title>
<year>1998</year>
<comment>Their first one</comment>
</row>
<row>
<id>2</id>
<bandsID>1</bandsID>
<title>More Talks</title>
<year>2000</year>
<comment>The second one</comment>
</row>
</row>
<row>
<id>2</id>
<name>Only Stupids</name>
<birth_year>1997</birth_year>
<birth_place>New York</birth_place>
<genre>Hip Hop</genre>
<row>
<id>3</id>
<bandsID>2</bandsID>
<title>All your base...</title>
<year>1999</year>
<comment>The Classic</comment>
</row>
</row>
</result>
</root>
'
有用 | 无用
<?php
include_once("XML/sql2xml.php");
$sql2xmlclass = new xml_sql2xml("mysql://username:password@localhost/xmltest");
$xmlstring = $sql2xmlclass->getxml("select * from bands left join albums on bands.id = bandsID");
?>
输出结果
$xmlstring = '
<?xml version="1.0"?>
<root>
<result>
<row>
<id>1</id>
<name>The Blabbers</name>
<birth_year>1998</birth_year>
<birth_place>London</birth_place>
<genre>Rock'n'Roll</genre>
<row>
<id>1</id>
<bandsID>1</bandsID>
<title>BlaBla</title>
<year>1998</year>
<comment>Their first one</comment>
</row>
<row>
<id>2</id>
<bandsID>1</bandsID>
<title>More Talks</title>
<year>2000</year>
<comment>The second one</comment>
</row>
</row>
<row>
<id>2</id>
<name>Only Stupids</name>
<birth_year>1997</birth_year>
<birth_place>New York</birth_place>
<genre>Hip Hop</genre>
<row>
<id>3</id>
<bandsID>2</bandsID>
<title>All your base...</title>
<year>1999</year>
<comment>The Classic</comment>
</row>
</row>
</result>
</root>
'
有用 | 无用
猜你喜欢
您可能感兴趣的文章:
- 用PHP生成自己的LOG文件
- VFP与其他应用程序的集成
- PHP中在数据库中保存Checkbox数据(1)
- 分页显示Oracle数据库记录的类之二
- 分页显示Oracle数据库记录的类之一
- 在线竞拍系统的PHP实现框架(一)
- 用在PHP里的JS打印函数
- 在PHP的图形函数中显示汉字
- PHP中在数据库中保存Checkbox数据(2)
- PHP中显示格式化的用户输入
- 提升PHP执行速度全攻略(下)
- PHP的面向对象编程
- PHP文本数据库的搜索方法
- PHP:风雨欲来 路在何方?
- 用Socket发送电子邮件(利用需要验证的SMTP服务器)
- 用PHP实现登陆验证码(类似条行码状)
- 用PHP创建PDF中文文档
- PHP与javascript对多项选择的处理
- 3