请教下php的Resource问题?
<?php<br />header("Content-type: text/html; charset=utf-8"); <br /> if(!empty($_POST['username'])){<br /> $name=$_POST['username'];<br />}<br /> if(!empty($_POST['pwd'])){<br /> $pwd=$_POST['pwd'];<br />} <br /> function sqlDql($name,$pwd){<br /> $conn=mysql_connect("localhost","root","root");<br /> if(!$conn){<br /> die("连接失败".mysql_error());<br /> }<br /> mysql_select_db("test",$conn) or die(mysql_error());<br /> //设置字符集<br /> mysql_query("set names utf8");<br /> $sql="select * from zhuche;";<br /> $res=mysql_query($sql,$conn) or die(mysql_error());<br /> while($row=mysql_fetch_row($res)){ <br /> if($name==$row[1]){<br /> echo "用户名已经存在<br/>";<br /> echo "<a href='login.php'>返回注册页面</a>"; <br /> // die(mysql_free_result($res)."连接".mysql_close($conn));<br /> mysql_free_result($res); <br /> mysql_close($conn);<br /> exit(); <br /> } <br /> }<br /> $sql2="insert into zhuche (Username,password) values ('".$name."','".$pwd."');";<br /> $res2=mysql_query($sql2,$conn) or die(mysql_error());<br /> echo "<table border='1px solid black'>";<br /> echo "<tr><td>序号</td><td>用户</td><td>密码</td></tr>";<br /> while($row=mysql_fetch_row($res)){<br /> echo "<tr>";<br /> foreach($row as $key=> $val){<br /> echo "<td>--".$val."</td>";<br /> }<br /> echo "</tr>";<br /> }<br /> echo "</table>"; <br /> mysql_free_result($res); <br /> mysql_close($conn);<br /> }<br /> sqlDql($name,$pwd);<br />?><br />