21,886
社区成员
发帖
与我相关
我的任务
分享
$row=mysql_fetch_array($rs);
语句写了两次,相当与第一次把指针向后移动了一次,然后又移动了一次,所以第一次没取到值,你去掉一个试试
每一次mysql_fetch_array()取数据,结果集中有一个指针往后移。
<?php
$sql="select * from uscontrol where usid=".$_SESSION["usid"];
$mysql_connector =new MysqlConnector();
$conn=$mysql_connector->connectMysql();
$rs=mysql_query($sql,$conn);
while($row=mysql_fetch_array($rs))
{
?>
<a href=" <?php echo $row["url"];?>" target="right"> <div class="tree_div" id="tree_div_112"> <span class="tree_img"> <img src="img/elbow.gif" id="touimg_112" width="16" border="0" height="18"> <img src="img/leaf.gif" id="img_112" width="16" border="0" height="16"> </span> <span class="tree_text"> <?php echo $row["title"];?> </span> </div> </a>
<?php
}
mysql_free_result($rs); //释放记录集
mysql_close($conn); //释放数据库连接
?>