Incorrect result from database access

All afternoon I was able to sign in (as a user) in my website as part of development and testing. All of a sudden I can’t sign in anymore. In the process of getting the user’s info from my database to check if valid user and valid password, I get “-1” affected rows. Yet, the row is in my database and all my code seems OK - I didn’t make any changes.

Can anyone see something wrong with my code?

$link = mysql_connect($host, $username, $password);
if (!$link){die('Not connected : ' . mysql_error());}
$db_selected = mysql_select_db($database, $link);
if (!$db_selected){die ('Can\'t use ' .$database .':'. mysql_error());}
$query = "SELECT FROM users WHERE `userid` = '$UserID' ";
$Results = mysql_query($query, $link);
$AffectedRows = mysql_affected_rows($link);
if($AffectedRows < 1)
	{print("Invalid User ID.……
print("$UserID");  <----------------- shows "nicky"  (correct code)
print("$AffectedRows");   <------------- shows  "-1"

My database “users” file contains userid = “nicky”

I don’t see why I’m getting -1 affected rows all of a sudden.

It’s resolved. Apparently I had an error in my SQL code.
I never found it. I replaced the code with code I had in another file and it now works.
Strange???