为什么mysql_num_rows返回零? [英] Why is mysql_num_rows returning zero?

查看:349
本文介绍了为什么mysql_num_rows返回零?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用C API的MySQL

I am using C MySQL API

int numr=mysql_num_rows(res);

它总是返回零,但在我的表有4个排在那里。不过,我得到正确的字段数。

It always returns zero, but in my table there are 4 rows are there. However, I am getting the correct fields count.

这是什么问题?难道我做错了什么?

what is the problem? Am i doing anything wrong?

推荐答案

只是一个猜测:

如果您使用了mysql_use_result() mysql_num_rows()不返回正确的值,直到所有的行结果集已经被检索。

If you use mysql_use_result(), mysql_num_rows() does not return the correct value until all the rows in the result set have been retrieved.

(从 MySQL手册

这篇关于为什么mysql_num_rows返回零?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆