为了账号安全,请及时绑定邮箱和手机立即绑定

mysqli_result与mysql_result函数运行错误

$con=mysqli_connect('localhost','root','123456');

mysqli_select_db($con,'chunyu');

mysqli_query($con,'set name utf8');

$query=mysqli_query($con,'select*from hello');

//echo mysqli_num_rows($query);

//$arr=mysqli_fetch_row($query);

//echo $arr[0];

echo mysql_result($query,0,1);

运行显示错误为undefined function mysqli_result();

当为mysql_result(),运行错误为ysql_result() expects parameter 1 to be resource, object given in D:\Demo\test01\index.php on line 9;

请各位大神指点,不胜感激!!

正在回答

2 回答

$query=mysqli_query($link,"select count(*) from hello");
$res = $query->fetch_array(MYSQL_NUM);
print_r($res[0]);
这样就可以得到了

0 回复 有任何疑惑可以回复我~

mysqli_query($con,'set names utf8');

系统显示不是有效的资源,换成echo mysqli_result($query,0,1);


0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
PHP与MySQL关系大揭秘
  • 参与学习       72504    人
  • 解答问题       978    个

让我们一起走上探秘之旅,找寻php和mysql恋爱的真谛

进入课程

mysqli_result与mysql_result函数运行错误

我要回答 关注问题
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号