-2

嘿,我想知道我的 ip_address 是否为 0,我想检查所有 ip_address 为 0 的表,然后执行该函数。所以像这样的代码:

    mysql_connect(db_server, db_user, db_pass);
$ipzerouseroffline = mysql_db_query(db_name,"SELECT ip_address = '0' FROM user"); 

if ( $ipzerouseroffline == 0 ) {
         //THEN CODE GOES HERE
    }

这是正确的写作方式吗?如果 ip_address 为零,则代码通过。

4

1 回答 1

1

我认为这就是你想要的:

$con = mysqli_connect(db_server, db_user, db_pass, db_name);
$result = mysqli_query($con,"SELECT * FROM user WHERE ip_address = '0'");
while($row = mysqli_fetch_array($result)){
 //CODE
}
mysqli_close($con);
于 2013-11-12T01:11:28.533 回答