A few thoughts :
- Especially when starting out, mysql_error() is your friend. It can be used as such :
mysql_db_select(...) or die(mysql_error());
mysql_db_query(...) or die(mysql_error());
mysql_fetch_row(...) or die(mysql_error());
Etc. Or, just realize it will print the last mysql_error so :
echo mysql_error();
Will print the last error so place it as such. Using it with die is easiest and fairly common. It prints human friendly errors that make sense and will tell you what's wrong, if anything.
As vincent stated, don't use @ unless you have a very specific reason. It supresses errors.
Tables are case sensitive so perhaps table 'user' exists but not 'USER'.
In SQL it's "common" to do stuff like this :
SELECT foo FROM blah WHERE bar='stuff'
You seem to be doing this the other way around. It's not required but looks very odd when done the other way around and can cause some issues, such as #3 above. If you happen to be using uppercase for your tables and fields, don't.
- Your $inputUserID will not parse as it's all in single quotes. And there is a ; in it which is bad. Consider :
mysql_db_query($db, "SELECT userid,username FROM user WHERE userid='$inputUserID'");
- Consider using mysql_fetch_array and/or mysql_fetch_object as they are less ambiguous then mysql_fetch_row but this is a preference of course, just a thought.
In closing, you're close :-)