【php开源代码栏目提醒】:本文主要为网学会员提供getChakan.php,希望对需要getChakan.php网友有所帮助,学习一下!
<?php
header('Content-Type: text/xml');
header("cache-control:no-cache,must-revalidate");
$xml="<?xml version='1.0' encoding='GB2312'?>";
$xml=$
xml."<contents>";
$link=mysql_connect("localhost","root","0");
//mysql_query("set names 'gbk'");
my
sql_select_db("books");
$exec="select * from mybook";
$result=
mysql_query($exec);
while($rs=mysql_fetch_object($result))
{
$id=$rs->id;
$name=$rs->name;
$author=$rs->author;
$pub=$rs->publisher;
$isbn=$rs->isbn;
$type=$rs->type;
$price=$rs->price;
$content=$content."<content><id>".$id."</id><name>".$name."</name><author>".$author."</author><publisher>".$pub."</publisher><isbn>".$isbn."</isbn><type>".$type."</type><price>".$price."</price></content>";
}
$xml=$xml.$content."</contents>";
echo $xml;
mysql_close();
?>