编辑:我的表格架构按照建议进行了很差的规范化,我已对其进行了修改。
答案 0 :(得分:2)
尝试在您的情况下使用mysql_num_rows()
if (mysql_num_rows($result) == 0) {
echo (" It's NULL!");
// if null, run a query!
} else {
echo (" It's not null...");
// if not null, echo back meessage saying not null.
}
编辑:没关系
EDIT2:天哪,我现在看到了,试试
$row = mysql_fetch_assoc($result);
if ($row[$userid] == NULL) {
echo (" It's NULL!");
// if null, run a query!
} else {
echo (" It's not null...");
// if not null, echo back meessage saying not null.
}
答案 1 :(得分:1)
尝试使用mysql_num_rows()
检查返回的行数,
if (mysql_num_rows($result) == 0)
{
echo (" It's NULL!");
// if null, run a query!
}
else
{
echo (" It's not null...");
// if not null, echo back meessage saying not null.
}
另外,您要选择哪一列?