Log in

View Full Version : Null querys?


merk
04-06-2002, 06:19 AM
If i run a query, to select all the forums that a user moderates, how can i check to see if the result is nothing?


if ($access=="") { echo "no access"; die; }


??

Would that work?

How would i do it if not?

Neo
04-06-2002, 06:33 AM
make it more OO please like this


if ($access=="") {
echo "no access";
die;
}

Admin
04-06-2002, 07:14 AM
No, that won't work.

$access = $DB_site->query_first("Your query here");
if (!$access) {
echo 'No access';
exit;
}
Queries never return an empty string.

merk
04-06-2002, 08:06 AM
Originally posted by neo
make it more OO please like this


if ($access=="") {
echo "no access";
die;
}


Like that matters :) - I normally do use the layed out format, but when typing i dont bother formatting my code.

FireFly : Thanks :)

Neo
04-06-2002, 08:54 AM
well if you can read it, but for other coders its better that way