Question: My query keeps giving a 

> 
> Warning: mysql\_num\_rows() expects parameter 1 to be resource, boolean given
> 
> 
> 

error at these 2 rows:

```
$num_pgs = mysql_num_rows($camp_pgs);
            $num_cid = mysql_num_rows($camp_id);

```

In this statement:

```
$userID=PageDB::getInstance()->get_user_id_by_name($_SESSION['user']);
            $result_pg=mysql_query("SELECT * FROM pages where campaign=" . $campaignID); 
            $result_cid=mysql_query("SELECT * FROM campaign where id=" . $campaignID); 
            $camp_pgs = mysql_query($result_pg);
            $camp_id = mysql_query($result_cid);
            $num_pgs = mysql_num_rows($camp_pgs);
            $num_cid = mysql_num_rows($camp_id);
            $i=0;
                        if ($num_pgs > 0){
                while ($row = mysqli_fetch_array($camp_pgs)):
                 $style = "";
                    if($i%2==0)

```

What I am trying to acchieve here is match 2 columns from 2 seperate tables where if table.column 1 = table.column 2 then list the results in a dynamic table.
The tables queried are "pages" and "campaigns" where I am trying to match column "campaignid" with column "id" respectively.

Thanks for your help!

Answer: 
replace

```
 $num_pgs = mysql_num_rows($camp_pgs);
 $num_cid = mysql_num_rows($camp_id);

```

with

```
$num_pgs = mysql_num_rows( $result_pg);
$num_cid = mysql_num_rows($result_cid);

```

REMOVE: 

```
 $camp_pgs = mysql_query($result_pg);
 $camp_id = mysql_query($result_cid);

```
```
$query = "SELECT * FROM pages, campaign WHERE campaign='".$campaignID."' AND campaign=id;";

// guess you have column "id" in both tables - then use this line
$query = "SELECT * FROM pages AS p, campaign AS c WHERE c.campaign='".$campaignID."' AND c.campaign=p.id;";

```