I am quite a noob at PHP/MySQL an thus far have managed to get by, however, now I need to get information from two tables that are related.
I have done much research on what I need to do, but can't seem to figure out where I have gone wrong. 

**QUESTION: How can I get the link from shortlinks table that is related to the shortlink in shortlink\_analytics?**

I get the error: **Warning: mysql\_fetch\_array() expects parameter 1 to be resource, boolean given** 

My tables are as follows:

**Shortlinks table**

id

shortlink

link 

createdTime

createdBy

**shortlink\_analytics table**

shortlink

referrer

hitTime

userIP

userAgent 

The code I have tried so far is:

```
$linecount = 1;
//$mostPop is where I think I have gone wrong and this is where the warning refers to
$mostPop = "SELECT shortlink, COUNT(shortlink) FROM shortlink_analytics JOIN shortlinks ON shortlink_analytics.shortlink = shortlinks.shortlink GROUP BY shortlink ORDER BY COUNT(shortlink) DESC LIMIT 10";
            $loadPop = mysql_query($mostPop);
            echo '<table id="middleIndex">';
            echo '<tr><td class = "overFlow"><h2>Most Popular Shortlink</h2></td></tr>';
            echo '<tr>';
            while($row = mysql_fetch_array($loadPop))
            {
                    echo '<td class = "overFlow">'.$row[1].' visits - <a href = "info.php?link='. $row['shortlink'] .'">hud.ac/' . $row['shortlink'] . '</a></td>';
                    echo '</tr>';
                    $linecount++;
            }
            echo '<tr id="indexMiddle"><td id="hand" class = "overFlow"><a onclick="indexMostPopular()">View More</a></td></tr>';
                echo '</table>';

```

I beleive that I do not have a thorough enough understanding behind how to use **JOIN** or the parameters that are required to form a successful join.