use two variables in a sql query
<p>I've put pagination into a site I'm building</p>

<p>and the problem I'm having is the second sql query doesn't appear to hold the url variable which supplies $cid</p>

<pre><code>    // This line sets the "LIMIT" range... the 2 values we place to choose a range of rows from database in our query
$limit = 'LIMIT ' .($pn - 1) * $itemsPerPage .',' .$itemsPerPage; 
// Now we are going to run the same query as above but this time add $limit onto the end of the SQL syntax
// $sql2 is what we will use to fuel our while loop statement below
$sql2 = mysql_query("SELECT * FROM products WHERE category='$cid' ORDER BY id ASC $limit");
</code></pre>

<p>What I'm trying to do is us the $cid to filter out everythig wit that category from the db and then apply the variable limit so I can control the number of outputs per page set earlier in the script.
the initial query works, when I select furniture from the menu (and restrict he output to one)the category page renders with one item and a page two for the second item, however when I click next or 2 I get a no data message, it's as if the second page doesn't find the $cid from the url</p>

<p>thanks</p>
