Help me out

in the config there is an session_start();
and Var… $config[user] is correct.
the db is selected…
user and pass are the field that have been enterd.

<? ob_start(); 
include("config.php");
// gather some .nfo
$user2 = $_POST['user'];
$pass2 = $_POST['pass'];
// true gethO scripting!
if($user2 != "" && $pass2 != "")
	{
		$select = "SELECT * FROM $config[user] WHERE user = \"$user2\" AND pass = \"$pass2\"";
		$query = mysql_query($select)or die(mysql_error());
		$stats = mysql_num_rows($query);
		if ($stats != "1") 
		{
			echo "There is no user with that pass go back";  
		}
		else
		{
			$select = "SELECT * FROM $config[user] WHERE user = \"$user2\" AND pass = \"$pass2\"";
			$query = mysql_query($select)or die(mysql_error());
			while( $row = mysql_fetch_object($query) )
			{
				$user = $row->user;
				$pass = $row->pass;
				$status = $row->status;
				// there is no logic to this script just leave :P
				setcookie("user", "$user", "$config[cookie]");
				setcookie("pass", "$pass", "$config[cookie]"
);
				
				session_register("user");
				session_register("status");
				
				$date = date('Y-m-d G:i:s');
				$update = "UPDATE $config[user] SET llogin = '$date' WHERE user = '$user2'";
				$query = mysql_query($update)or die(mysql_error());
				echo "You have logged in.<br>Click <a href=index.php>here</a> to go back";
			}
		}
}else{ 
		echo "fill in a username or password. ";
}
mysql_close($dbLink); 
?>

This is my log in script…

it returns;
You have logged in.
Click here to go back
Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /home/returnof/public_html/inloggen.php on line 20

All the cookies are made and the sessions to. But it gives this failt… I really don’t know What I’m doing wrong here…
You know if it didn’t make the cookies and sessions i might be the the MySQL string but… I don’t know… Please help.