Q:

SQL left join part of the array is empty

My problem is the following code the comment&rating area of the array should have a comment in it as the DB history table does ...?
 SELECT users.uid, users.username, history.user_id, history.comment, history.rating
 FROM history
 LEFT JOIN users
 ON users.uid=history.user_id
 WHERE history.book_id="$bid"

It returns :
 Array ( [uid] => 3 [username] => Reign [user_id] => 3 [comment] => [rating] => )

A:

Then you want to use an INNER JOIN. A LEFT JOIN will return NULL values.
SELECT users.uid, users.username, history.user_id, history.comment, history.rating
FROM history
INNER JOIN users
ON users.uid=history.user_id
WHERE history.book_id="$bid"

