I am presuming that your
mysql_connect call is in your
inc/sql_connect.php file...
This is always required if you are going to call any mysql method.
Therefore, your problem is probably that the table
users doesn't exist, or maybe you are forgetting to select the database you are working in beforehand using
mysql_select_db
Alternatively you can bypass selecting the database beforehand (i.e. if you don't want to touch your
sql_connect file and call the table directly using the
dbname.
tablename syntax.
i.e. if your
users table falls under, let's say, the
mydata schema, your command would read:
Code:
SELECT users.user_id FROM mydata.users WHERE username='{$username}'
hope i was of help... if that doesn't work... kindly paste your
sql_connect file here also.
Note: I always like fully qualifying field names, since it makes life easier should you want to build the query further in the future, and it avoids stupid mistakes where field names could conflict with keywords.