MySQL 'user_id' in where clause is ambiguous problem

后端 未结 4 1654
逝去的感伤
逝去的感伤 2020-11-28 16:49

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.

4条回答
  •  自闭症患者
    2020-11-28 16:57

    You simply need to specify which user_id to use, since both the user_info and user table have a field called user_id:

    ... WHERE user.user_id='$user_id'
    

    SQL wouldn't tolerate this ambiguity, since for what it knows, both fields can represent totally different data.

提交回复
热议问题