我在代码的另一部分成功地加入了表格,所以我遵循了相同的模式,但这次它没有返回任何结果,我不明白为什么。
以下是我要加入的表格:
- 角色
| id | type |
+----+--------+
| 1 | admin |
| 2 | author |
| 3 | member |
+----+--------+
- 用户
+----+----------+-------+----------+-------------------+--------+
| id | username | email | password | role_id | status |
+----+----------+-------+----------+-------------------+--------+
| | | | | 3 (default value) | |
+----+----------+-------+----------+-------------------+--------+
这是请求:
public function get_users()
{
$users_list = $this->dbh->query('SELECT users.id, roles.id AS roleid, type, role_id, id, username FROM users LEFT JOIN roles ON users.role_id = roles.id ORDER BY id ASC');
return $users_list;
}
森林海
慕的地10843
尚方宝剑之说