新手求助,php循环问题
代码中的while不循环,只能输出一行结果。
还有数据库里有中文的话,运行的时候会报错。
求指教!
<br />header("Content-type:text/xml;charset=utf-8"); <br />$conn = new com("ADODB.Connection"); <br />$connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=". realpath("syec_mtv.mdb"); <br />$conn->Open($connstr); <br />mysql_query("set names utf8;"); <br />$rs = new com("ADODB.RecordSet"); <br />$rs->Open("select * from mtv_singer",$conn,3,1);<br /><br />echo '<?xml version="1.0" encoding="utf-8" ?>';<br />echo '<veryhdmtvsinger>';<br />echo '<pageinfo recordcount="2000" pagecount="48" pagesize="40" pageindex="1"/>';<br />echo '<mtvsingerlist>';<br />while(!$rs->eof){ <br />$field_0=$rs->Fields(0); <br />$field_1=$rs->Fields(1);<br />$field_2=$rs->Fields(2); <br />$field_3=$rs->Fields(3); <br />$field_4=$rs->Fields(4); <br />$field_5=$rs->Fields(5); <br />$field_6=$rs->Fields(6); <br />echo "<mtv singerid='$field_0' singercid='$field_1' singer='$field_2' singersex='$field_3' singerarea='$field_4' singerimg='http://192.168.252.66/$field_5' singersid='http://192.168.253.34:103?sid=$field_6' />";<br />$rs->MoveNext(); <br />}<br />echo '</mtvsingerlist>';<br />echo '</veryhdmtvsinger>';<br />