$exec="select count(*) as count from blacklist";
$result=mysql_query($exec);
$row=$result->fetch();
echo $row['count'];

解决方案 »

  1.   

    $exec="select count(*) as count from blacklist";
    $result=mysql_query($exec);
    $row=$result->fetch();
    echo $row['count'];
    一定要比$exec="select * from blacklist";
    $result=mysql_query($exec);
    $recountCount = mysql_num_rows($result);

    不过我想 select count(index)  as number from blacklist会更好一些
    sqlserver中 count(*)是自动找索引的 不知道mysql中是不是,如果这个表中那个字段需要经常查 还是建立个索引比较好