im getting an error on mysql when im trying to login as admin

Code:
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /home/xxxxx/public_html/xxxx/login.php on line 17
this is where the error starts:

Code:
		$sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'";
		$result=mysql_query($sql);
		$count=mysql_num_rows($result);  <------------- ERROR
		if($count >= 1){
		session_register("myusername");
		session_register("mypassword");
		header("location: index.php");
		} else {
			
		}
	}