如果出错,选择多个表将不返回结果

I'm making a leaderboard. To get all information into it, I need to select multiple tables because it has to be in the same while statement.

I'm using this code:

$result = mysqli_query($con, "SELECT *, @rn := @rn + 1 as Rank
FROM Leaderboard_Tag, Player_Data WHERE Player_Data.UUID=Leaderboard_Tag.UUID, (SELECT     @rn := 0 ) r
ORDER BY Wins,Got_Tagged DESC LIMIT 0,10");

And this to show it:

$rank = 1;

                    if ($result->num_rows > 0) {
                        while ($row = mysqli_fetch_assoc($result)) {
                            $Username=$row['Leaderboard_Tag.Username'];
                            $Tokens = $row['Player_Data.Tokens'];
                            $Wins=$row['Leaderboard_Tag.Wins'];
                            $Got_Tagged = $row['Leaderboard_Tag.Got_Tagged'];

                            echo "<tr>
                            <td class=\"rank\">$rank</td>
                                <td><div class=\"row\">
                                        <div class=\"td-avatar\">
                                            <img class=\"avatar-small\" src=\"http://website.craftshark.net/avatar/avatar/$Username/40\">
                                        </div>
                                        <div class=\"td-user\">
                                            <a class=\"lb-username\" href=\"../player/$Username\">$Username</a>
                                            <br>
                                            <small class=\"lb-desc\"><i class=\"fa fa-star tokens-small\"></i> $Tokens</small>
                                        </div>
                                    </div></td>
                                <td class=\"got_tagged\">$Got_Tagged</td>
                                <td class=\"wins\">$Wins</td>
                                </tr>";
                            $rank++;
                        }
                    }

For some reason it doesn't return anything in the table. http://puu.sh/8KJko.png

But it does return a error at line 92:

if ($result->num_rows > 0) {

As I said, I got 2 tables in the same DB. Player_Data and Leaderboard_Tag. Each user has a own unique ID. In both tables they are the same.

What is wrong? It worked before, without the multiple table select with this code:

$result = mysqli_query($con, "SELECT Username,Wins,Got_Tagged,@rn := @rn + 1 as Rank
FROM Leaderboard_Tag, (SELECT @rn := 0 ) r
ORDER BY Wins,Got_Tagged DESC LIMIT 0,10");

Seems you have a malformed WHERE statement:

... WHERE Player_Data.UUID=Leaderboard_Tag.UUID, (SELECT @rn := > 0 ) r

I assume it should be like this, unless the subquery is misplaced and belongs in the FROM section.

... WHERE Player_Data.UUID=Leaderboard_Tag.UUID AND @rn > 0

That being said, using variables like this (manipulating and comparing within the same statement) may give unexpected results according to the MySQL documentation.