执行这语句,然后取得的第一个字段就是
这样
if not rs.eof then
   count=rs(1)

解决方案 »

  1.   

    $sql = "select count(*) as count from tableName";
    $result = mysql_query($sql);
    $row = mysql_fetch_array($result);
    echo $row[count];//显示你查询的数量
      

  2.   

    mysql> use mysql
    Database changed
    mysql> SELECT COUNT(*) FROM user;
    +----------+
    | COUNT(*) |
    +----------+
    |        4 |
    +----------+
    1 row in set (0.05 sec)mysql> SELECT @User_Count := COUNT(*) FROM user;
    +-------------------------+
    | @User_Count := COUNT(*) |
    +-------------------------+
    |                       4 |
    +-------------------------+
    1 row in set (0.05 sec)mysql> SELECT @User_Count;
    +-------------+
    | @User_Count |
    +-------------+
    | 4           |
    +-------------+
    1 row in set (0.00 sec)mysql> SELECT @User_Count;
    +-------------+
    | @User_Count |
    +-------------+
    | 4           |
    +-------------+
    1 row in set (0.00 sec)mysql> SELECT @User_Count,@User_Count-1,@User_Count*4;
    +-------------+---------------+---------------+
    | @User_Count | @User_Count-1 | @User_Count*4 |
    +-------------+---------------+---------------+
    | 4           |             3 |            16 |
    +-------------+---------------+---------------+
    1 row in set (0.01 sec)mysql>