The query below returns this error:
Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in xxx.php on line 21. Fatal error: Call to a member function fetch_assoc() on boolean in xxx.php on line 24
The query only seems to work when I remove the 'userID' column from both SELECT statements. Does this have anything to do with the fact that i'm using 'userID' for my INNER JOIN? How can I fix this issue? Thanks in Advance.
QUERY;
$sql = "SELECT parentID, userID, Rating, Comment, upvote_count, Time FROM ratings_n_comments
INNER JOIN user_details
ON ratings_n_comments.userID=user_details.UserID
WHERE ratings_n_comments.mID= '".$mID."'
UNION
SELECT parentID, userID, Rating, Comment, upvote_count, Time FROM replys_to_comments
INNER JOIN user_details
ON replys_to_comments.userID=user_details.UserID
WHERE replys_to_comments.mID= '".$mID."'";