|
在时间上,sql/Index.html'>mysql_eof()先于标准MySQL错误函数sql/Index.html'>mysql_errno()和sql/Index.html'>mysql_error()。因为这些错误函数提供相同的信息,他们的使用更好sql/Index.html'>mysql_eof(),它现在不建议使用。(事实上,他们提供更多的信息,因为sql/Index.html'>mysql_eof()值返回一个布尔值,而错误函数指出当发生错误时的出错原因。) 20.4.10.2返回值如果发生一个错误,零。如果到达结果集合的结束,非零。 20.4.10.3错误无。 20.4.10.4范例下列例子显示你必须如何使用sql/Index.html'>mysql_eof(): sql/Index.html'>mysql_query(&sql/Index.html'>mysql,"SELECT*FROMsome_table");result=sql/Index.html'>mysql_use_result(&sql/Index.html'>mysql);while((row=sql/Index.html'>mysql_fetch_row(result))){//dosomethingwithdata}if(!sql/Index.html'>mysql_eof(result))//sql/Index.html'>mysql_fetch_row()failedduetoanerror{fprintf(stderr,"Error:%s\n",sql/Index.html'>mysql_error(&sql/Index.html'>mysql));}然而,你可以用标准MySQL错误函数完成同样的效果: sql/Index.html'>mysql_query(&sql/Index.html'>mysql,"SELECT*FROMsome_table");result=sql/Index.html'>mysql_use_result(&sql/Index.html'>mysql);while((row=sql/Index.html'>mysql_fetch_row(result))){//dosomethingwithdata}if(sql/Index.html'>mysql_errno(&sql/Index.html'>mysql))//sql/Index.html'>mysql_fetch_row()failedduetoanerror{fprintf(stderr,"Error:%s\n",sql/Index.html'>mysql_error(&sql/Index.html'>mysql));}20.4.11sql/Index.html'>mysql_errno()上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [30] [31] [32] 下一页
|