应该是odbc_num_field(resource result_id);
返回字段数,其中,result_id是由odbc_exec()的到的
odbc_num_rows(int result_id)返回符合你的查询条件的记录数,值是-1说明没有符合条件的

解决方案 »

  1.   

    odbc_num_field是取得字段数目.
    但我用odbc_fetch_row能够等到内容啊
      

  2.   

    看看www.php.net 是怎么说的吧int odbc_num_rows ( resource result_id)
    odbc_num_rows() will return the number of rows in an ODBC result. This function will return -1 on error. For INSERT, UPDATE and DELETE statements odbc_num_rows() returns the number of rows affected. For a SELECT clause this can be the number of rows available. Note: Using odbc_num_rows() to determine the number of rows available after a SELECT will return -1 with many drivers. 注意它的note,所以这就不奇怪了
    你可以用"select count(*)………………"
    来实现啊
    浅妄薄见,望与斟酌
      

  3.   

    那么odbc_num_rows()到底能起什么作用呢?
    按上面的说法它不是没用了吗
      

  4.   


      select count(*) as totalcount from table;  取的时候是$totalcount=rs['totalcount']; 就可以了
      

  5.   

    Access 数据库并不支持
    odbc_num_rows(int result_id)函数
    我以前也是
    后来没办法只能自己写了
      

  6.   

    有时候odbc_num_rows()无效
    我这里更奇怪,竟然返回-1.Using odbc_num_rows() to determine the number of rows available after a SELECT will return -1 with many drivers. 可能驱动有问题.用
    while(list($name)=odbc_fetch_row($rel)){
       $n++;
    }
    echo $n;
      

  7.   

    while(odbc_fetch_row($rel))
       $n++;
    echo $n;