<?php
error_reporting
(E_ALL ^ E_NOTICE);
header(
"Content-type:text/xml"
);
print
(
"<?xml version="
1.0
"encoding="
gb2312
"?>"
);
include
(
"../include/mysql.class.php"
);
$id
=(isset(
$_GET
[id]))?
$_GET
[id]:0;
print
(
"<tree id='"
.
$id
.
"'>"
);
show_item('table_name',0);
print
(
"</tree>"
);
function
show_item(
$database
,
$pid
)
{
$db
=
new
mysql();
$query
=
"select * from $database where parent='$pid'"
;
$result
=
$db
->query(
$query
);
while
(
$r
=
$db
->fetch_array(
$result
))
{
print
(
"<item id='"
.
$r
[id].
"' text='"
.
$r
[category].
"'><userdata name='rank'>"
.
$r
[rank].
"</userdata><userdata name='category'>"
.
$r
[category].
"</userdata>"
);
if
(
$r
[rank]!='3')show_item(
$database
,
$r
[id]);
print
(
"</item>"
);
}
$db
->close();
}
?>