Php 为什么mysql_num_row小于条件不';不行?

Php 为什么mysql_num_row小于条件不';不行?,php,mysql,Php,Mysql,为什么我不能得到正确的回声echo$tot给我3 由于某些原因,$row变量在if($row

为什么我不能得到正确的回声<代码>echo$tot给我3

由于某些原因,$row变量在
if($row<$b)

使用以下命令:

<?php
$sql=mysql_query("SELECT ID FROM emp WHERE user='$login_session'"); // its currently zero
$row=mysql_num_rows($sql);
$b = 3;
$tot=$b - $row;
echo "$tot"; 

if($row < $b) {
echo "good";
} else { echo "wrong"; }
?>
在我的代码中,顺序是:

Assign something to this variables
Ouput undefined variables

您试图在定义变量$row和$b之前使用它们。这是程序性的,自上而下的执行。不要再使用mysql了,因为它已经被弃用了。谢谢你,我错过了,抱歉,这个愚蠢的问题。
Ouput undefined variables
Assign something to this variables
Assign something to this variables
Ouput undefined variables