Seems like the value of the cookie is an empty space concatenated with the username:
" ". $_POST['myusername'] .""
Is your username in database 'admin' or ' admin'?
Change your code when setting the cookie to this simpler version:
$date_of_expiry = time() + 300 ;
setcookie( "userlogin", $_POST['myusername'], $date_of_expiry );