Warning: mysql_affected_rows() expects parameter 1 to be resource
PS:前面的内容"修改成功,修改的条数为"都正常显示,只是后面出来警告了。当我把 mysql_affected_rows($con) 里面的参数去掉以后可以正常显示。
<?php
header('content-type:text/html;charset=utf-8');
$con=mysqli_connect('localhost','root','123456');//打开数据库,返回连接标识符
mysql_select_db('test');
mysql_query('set names utf8');
if(mysql_query("update tb2 set usename='fuck' where id=1")){
echo '修改成功,修改的条数为';
echo mysql_affected_rows($con);//连接标识符
}else{
echo '修改失败';
}
?>
求助各位了!!