计数器的统计如何实现
我有一个源码如下:
<?
$mysql_server_name="localhost";
$mysql_username="root";
$mysql_password="122801014";
$mysql_database="xufan2009";
$conn=mysql_connect( $mysql_server_name, $mysql_username, $mysql_password);
$sql= "INSERT INTO `mytest` (`num` )VALUES ('1')";
mysql_select_db($mysql_database,$sql);
$result=mysql_query($sql);
mysql_close($conn);
//.................................................................................
$conn=mysql_connect($mysql_server_name,$mysql_username,$mysql_password);
$sql="select count(*) from mytest";
$result=mysql_db_query($mysql_database,$sql,$conn);
$row=mysql_fetch_row($result);
//print_r($row);
mysql_free_result($result);
?>
<html>
<head>
<title>徐帆的主页</title></head>
<body>
<?PHP echo "已经有<?$row[0]?>人到访" ?>
</body>
</html>
调试结果:
Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in D:\AppServ\www\guwenjie.php on line 12 已经有人到访
请问大家怎么改啊?我刚学,不是很清楚。