You should call mysqli_error
with parameter:
if (!$dbc) {
print mysqli_error($mysqli);
}
EDITED:
You join two table with the same names. I think in FROM
you made typo. Shouldn't it be FROM users
? Table users
appears in column list but you do not have it anywhere in FROM or JOINs.
SELECT users.*, categories.*, users_categories.*
FROM users
INNER JOIN users_categories ON users_categories.user_id = users.user_id
JOIN categories ON users_categories.user_id = users.user_id
WHERE users_categories.user_id=3