这段PHP代码那儿错了
<?//基本设定$mysql_server_name="localhost";$mysql_username="root";$mysql_password="";$mys...
<?
//基本设定
$mysql_server_name = "localhost";
$mysql_username = "root";
$mysql_password = "";
$mysql_database = "counter";
//连接
$conn=mysql_connect( $mysql_server_name, $mysql_username, $mysql_password);
//SQL语法每增加一个多一个栏位
$sql="INSERT INTO `sun`.`counter` (`new` )VALUES ('1')";
//选择处理的资料库
mysql_select_db($mysql_database,$conn);
//进行查询活执行
$result = mysql_query($sql);
//结束并且释放连接
mysql_close($conn);
//..返回值代码.........................................
//连接
$conn=mysql_connect( $mysql_server_name, $mysql_username, $mysql_password);
//SQL语法
$sql="SELECT * FROM `counter`";
//进行查询选取
$result=mysql_db_query($mysql_database,$sql,$conn);
//查询后的结果 抓出一笔
$row=mysql_fetch_row($result);
//打印出所有栏位
print_r($row);
//清楚查询结果
mysql_free_result($result);
?>
错误提示为:
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\index.php on line 39
Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\index.php on line 45 展开
//基本设定
$mysql_server_name = "localhost";
$mysql_username = "root";
$mysql_password = "";
$mysql_database = "counter";
//连接
$conn=mysql_connect( $mysql_server_name, $mysql_username, $mysql_password);
//SQL语法每增加一个多一个栏位
$sql="INSERT INTO `sun`.`counter` (`new` )VALUES ('1')";
//选择处理的资料库
mysql_select_db($mysql_database,$conn);
//进行查询活执行
$result = mysql_query($sql);
//结束并且释放连接
mysql_close($conn);
//..返回值代码.........................................
//连接
$conn=mysql_connect( $mysql_server_name, $mysql_username, $mysql_password);
//SQL语法
$sql="SELECT * FROM `counter`";
//进行查询选取
$result=mysql_db_query($mysql_database,$sql,$conn);
//查询后的结果 抓出一笔
$row=mysql_fetch_row($result);
//打印出所有栏位
print_r($row);
//清楚查询结果
mysql_free_result($result);
?>
错误提示为:
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\index.php on line 39
Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\index.php on line 45 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询