Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP isnull First pass/Second pass flag
    text
    copied!<p>I have a PHP results page which starts off "first-pass" with ALL rows returned. It's a search listing of all pizza places in the county. </p> <pre><code>SELECT * from pizzeria; </code></pre> <p>Then the user can drill down into more detail... the page also has a CSS dropdown menu where the user can pick a specific neighborhood (which carries a URL):</p> <pre><code>href="samepage.php?neighborhood=HELLSKITCHEN" </code></pre> <p>which then changes the query after I pick up the <code>$_GET[]</code></p> <pre><code>SELECT * from pizzaria WHERE nbh=(the $_GET[] variable sent in the URL); </code></pre> <p>but I'd like the page to call itself and I have <code>header("Cache-Control:no-cache");</code> at the top.</p> <p>I'm trying to create a first-pass or first visit flag variable with the <code>isnull()</code> function:</p> <pre><code>if (is_null($firstpass)) { $query = SELECT all the records from the pizzaria table } else { $query = SELECT only the records WHERE I $_GET[] the value from the reloaded URL } </code></pre> <p>It seems though that the <code>$firstpass</code> variable doesn't stick on reloads. Should I SESSION that variable? (though still have the problem of constantly resetting it)</p> <p>Or maybe implement some other approach?</p> <p>I know I can redirect to a separate second page and javascript back to this page to avoid "headers already sent", but I want to avoid the round-trip back to the client.</p> <p>Is there a known best practice on reloads with new info? Kinda new to PHP here. thanks</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload