Need PHP Help
Well... I've spent 3 hours looking at it... I checked spelling, syntax, and logic, and it all gives the same error.It is part of a page object, in which all of the functions are defined and work fine. The query executes with no problem, but then it gets an error on the mysql_num_rows() line, saying that $result is not a valid result identifier. Anyone know why?
I posted this in the main forum by mistake... Here it is again.

PHP Code:
function checkauth()
{
global $PHP_AUTH_USER, $PHP_AUTH_PW, $PHP_SELF;
global $userid, $password, $username, $userconame;
if(!isset($username))
{
$this->startpage();
$this->loginpage();
$this->endpage();
exit;
}
else
{
session_register($password, $username);
$query = "SELECT id, name FROM companies WHERE username='$username' AND password=password('$password')";
$result = mysql_query($query, $this->conn);
if(!mysql_num_rows($result))
{
session_unregister($password);
session_unregister($username);
$this->startpage();
$this->loginpage();
$this->endpage();
}
else
{
$record = mysql_fetch_object($result);
$userconame = $record->name;
$userid = $record->id;
}
}
}