Reputation: 140
edit: my table schema below is poorly normalized as suggested and I have revamped it.
Upvotes: 0
Views: 267
Reputation: 1934
Try to use mysql_num_rows()
in your condition
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.
}
EDIT: nevermind
EDIT2: Gosh, I see it now, try
$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.
}
Upvotes: 2
Reputation:
Try using mysql_num_rows()
for checking how many rows are returned,
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.
}
Also, what column are you trying to select ?
Upvotes: 1