example2.php
更新時(shí)間:2006年10月09日 00:00:00 作者:
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");
?>
輸出結(jié)果
$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>
'
相關(guān)文章
PHP輸出控制功能在簡(jiǎn)繁體轉(zhuǎn)換中的應(yīng)用
PHP輸出控制功能在簡(jiǎn)繁體轉(zhuǎn)換中的應(yīng)用...2006-10-10PHP4實(shí)際應(yīng)用經(jīng)驗(yàn)篇(4)
PHP4實(shí)際應(yīng)用經(jīng)驗(yàn)篇(4)...2006-10-10PHP數(shù)組中頭部和尾部添加元素的方法(array_unshift,array_push)
對(duì)于數(shù)字索引數(shù)組來說,通過 array_push()函數(shù)向數(shù)組中尾部添加元素,array_unshift頭部添加元素,需要的朋友可以參考下2017-04-04