I'm kinda of stuck here for a while maybe you guys can help me out? I want to highlight a table of database record, coming from one table, and check if the id out of this table also exists in the 2nd table.   

Let me be more specific:   

```
Table 1: Projects (projectid pk)
Table 2: Reservations (projectid fk)

```

A simple sample code, to keep this simple:

```
while( $record=mysql_fetch_array($result) ) 
{
    $projectid=$record['projectid'];
    echo "<tr>". $projectid ."</tr>; 
}

```

So this is working great, I get all table rows with each projectid which exists in my DB, but how to pass this `$projectid` variables to another query which checks if this exists in the other table, and if it exists, echo out something different? Here's my code which probably doesn't make much sense, but at least the logic is there... I hope?:   

```
while( $record=mysql_fetch_array($result) ) 
{
    $projectid=$record['projectid'];
    $hasreservationquery = ("
                            SELECT * 
                            FROM reservelist rl
                                INNER JOIN project p on rl.projectid = p.projectid
                            WHERE rl.projectid = $projectid
                            ");
    $hasreservationqueryresult = mysql_query($hasreservationquery) or die(mysql_error());
    if ($hasreservationqueryresult > 1)
    {
    echo "<tr id='hasreservation'>";
    }
    else
    {
    echo "<tr>";
    }
    echo "". $projectid .""; 
}

```

Unfortunately this returns all tables highlighted, not just the one that really has a reservation in it. What am I doing wrong??

Thanks in advance.