欢迎光临
我们一直在努力

example2.php-PHP教程,XML应用

建站超值云服务器,限时71元/月

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>rocknroll</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>

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » example2.php-PHP教程,XML应用
分享到: 更多 (0)

相关推荐

  • 暂无文章