mysql count其中row = 0

时间:2013-10-31 20:02:48

标签: php mysql count

我正在尝试显示计数,但只显示列deleted等于0的位置

这是我试过的

$result=mysql_query("SELECT * FROM users where deleted=0")or die('Error ' );

$counter = mysql_query("SELECT COUNT(*) as personID FROM users");
$row = mysql_fetch_array($result);

    $personID = $row['personID'];
    $personFname = $row['personFname'];
    $personSname = $row['personSname'] ;
    $llmail = $row['llmail'];
    $mainadmin = $row['mainadmin'];
     $delete = $row['delete'];
$num = mysql_fetch_array($counter);
$count1 = $num["personID"];

这显示了4的计数,但是4中的2被删除所以如果这有意义的话它应该只显示2?

1 个答案:

答案 0 :(得分:0)

SELECT COUNT(*) as personID FROM users WHERE deleted=0