当前位置: 首页 > 图文教程 > 网络编程 > PHP > example2.php

PHP
真正面向对象编程:PHP5.01发布
Zend公司全球首推PHP认证
使用MaxMind 根据IP地址对访问者定位
动态网站web开发 PHP、ASP还是ASP.NET
PHP5.0正式发布 不完全兼容PHP4 新增多项功能
PHP的一个完整SMTP类(解决邮件服务器需要验证时的问题)
提升PHP执行速度全攻略(上)
两种php调用Java对象的方法
PHP开发文件系统实例讲解
如何使用动态共享对象的模式来安装PHP
PHP编程网上资源导航
PHP安全编程之加密功能
PHP使用者状态管理功能的应用
用IE远程创建Mysql数据库的简易程序
phpBB BBcode处理的漏洞
一个目录遍历函数
生成缩略图
模拟xcopy的函数
PHP 中执行系统外部命令
PHP输出控制功能在简繁体转换中的应用

PHP 中的 example2.php


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-13   浏览: 76 ::
收藏到网摘: n/a


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>
'