title: PHP: How to use this code on different page
body: <p>I'd like to use the code below for multiple pages. I tried putting the <code>$listloadpage</code> in an <code>array("page-1", "page-2")</code> but <code>stristr()</code> doesn't work that way.</p>
  
  <pre><code>$currentpage = $_SERVER['REQUEST_URI'];
  $listloadpage = "page-1";
  if(stristr($currentpage, $listingloadpage) !== false)
  {
      $database-&gt;query('SELECT id, name FROM table_1 ORDER BY name', array());
      $results = $database-&gt;statement-&gt;fetchAll(PDO::FETCH_ASSOC);
  }
  </code></pre>
  
  <p>I'd rather not have to repeat the code above for "page-2".</p>
  
  <p>URL would look like <code>http://www.domain.com/index.php?action=page-1</code></p>
  
  <p><strong>EDIT:</strong> Thanks to Dagon I got it to work...</p>
  
  <pre><code>$listloadpage = array("page-1", "page-2");
  if(in_array($_GET['action'], $listingloadpage) !== false)
  {
      // Display content
  }
  </code></pre>