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

PHP
搜索引擎核心技术(PHP编程思路) --[1]
PHP巧获服务器端信息
用PHP实现标准的IP Whois查询
利用Yahoo! Search API开发自已的搜索引擎-php版
用php实现gb2312和unicode间的编码转换
用php发送带附件的Email
解决RHAS3中Apache2的PHP上传文件大小的限制
PHP和JAVA的XML-RPC中文问题解决办法
令你的网站获得任意Google PR值的方法
PHP应用分页显示制作详细讲解
使用php通过Socket进行发信源码,支持发信认证
Smarty实例教学 实例篇
用ActivePHP打造版本管理系统
Linux下安装GD
Apache2的httpd.conf翻译
PHP5的XML新特性
PHP5对象体系
Mysql 4.1 Windows 下升级问题
建立灵巧结构的PHP程序
PHP入门速成(3)

PHP 中的 example2.php


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-13   浏览: 44 ::
收藏到网摘: 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>
'