How can I correct the problem I keep getting from the code below which states 'user_id' in where clause is ambiguous
. Thanks for the help in advance.
Here is the mysql table.
SELECT user.*, user_info.*
FROM user
INNER JOIN user_info ON user.user_id = user_info.user_id
WHERE user_id='$user_id'
Try this.
The solution is to select each column explicitly everywhere. Don't use user.* and user_info.* in your select list, either:
You simply need to specify which
user_id
to use, since both theuser_info
anduser
table have a field calleduser_id
:SQL wouldn't tolerate this ambiguity, since for what it knows, both fields can represent totally different data.
You should be mention alias name of your column and assign to user_id like