title: GET variable not being accessed
body: <p>I have a simple <em>7 lined</em> <code>PHP</code>script, as shown below:</p>
  
  <h1>Code</h1>
  
  <pre><code>require( "connect.php" );
  $ctg = ($_GET['ctg'])? $_GET['ctg']:'movie';
  $offset = ($_GET['off'])? $_GET['off']:30;
  $query = "SELECT `msg`, `id`, `nick`, `date` FROM `entries` WHERE `ctg` = ? ORDER BY `id` DESC LIMIT 15 OFFSET ?";
  $statemnt = $conn-&gt;prepare( $query );
  $statemnt-&gt;bindParam( 1, $ctg, PDO::PARAM_STR );
  $statemnt-&gt;bindParam( 2, $offset, PDO::PARAM_INT );
  $statemnt-&gt;execute();
  $results = $statemnt-&gt;fetchAll( PDO::FETCH_ASSOC );
  echo "$ctg\n$offset\n" . count($results) . "\n";
  </code></pre>
  
  <h1>Problem</h1>
  
  <p>The problem I am facing is like this: When I execute the file in console(using <code>php fetch.php</code>), all the <code>echo</code> work great. When I open the page in browser with no <code>$_GET</code> variables, the same output is observed.</p>
  
  <p>The output in browser is the same when I provide it with just the <code>ctg</code> indexed-variable(such as <code>http://localhost/fetch.php?ctg=docu</code>) the output is correct; like this:</p>
  
  <pre><code>docu
  30
  15
  </code></pre>
  
  <p>But when I pass the <code>off</code> index-variable(either as <em><code>fetch.php?off=15</code></em> <strong>OR</strong> <em><code>fetch.php?ctg=docu&amp;off=15</code></em> <strong>OR</strong> <em><code>fetch.php?off=15&amp;ctg=docu</code></em>); The output is always like this:</p>
  
  <pre><code>docu
  15
  0
  </code></pre>
  
  <h1>Question</h1>
  
  <p>The output(and <code>var_dump</code>) both show correct values being passed to both variables, then why is the PDO statement not receiving any results? Why does the <code>count($results)</code> remain <strong>0</strong>?</p>
  
  <p>Any help is appreciated.</p>
  
  <hr>
  
  <h1>PS</h1>
  
  <p>I also included the following statement:</p>
  
  <pre><code>$statemnt-&gt;debugDumpParams();
  </code></pre>
  
  <p>which dumps this in browser(and console):</p>
  
  <pre><code>SQL: [102] SELECT `msg`, `id`, `nick`, `date` FROM `entries` WHERE `ctg` = ? ORDER BY `id` DESC LIMIT 15 OFFSET ?
  Params:  2
  Key: Position #0:
  paramno=0
  name=[0] ""
  is_param=1
  param_type=2
  Key: Position #1:
  paramno=1
  name=[0] ""
  is_param=1
  param_type=1
  </code></pre>