Skip navigation
Currently Being Moderated

Can I have multiple parameters in a Default value for a variable in a recordset

Jan 18, 2013 8:14 AM

Tags: #variables #sql #recordset #php_coding

I have three variables in a record set that retrieves results from URL parameters:


variables =


$varAccess_rsAwaitingSecureAccess = "-1";

if (isset($_GET['AccessCode'])) {

  $varAccess_rsAwaitingSecureAccess = $_GET['AccessCode'];


$varAddress_rsAwaitingSecureAccess = "-1";

if (isset($_GET['UserAddress2'])) {

  $varAddress_rsAwaitingSecureAccess = $_GET['UserAddress2'];


$varVerified_rsAwaitingSecureAccess = "-1";

if (isset($_GET['emailVerified'])) {

  $varVerified_rsAwaitingSecureAccess = $_GET['emailVerified'];



URL Parameters =


<li><a href="grantAccess.php?emailVerified=1&amp;UserAddress2=Arequipa_Reef& amp;AccessCode=No_Access">Arequipa Reef</a></li>

<li><a href="grantAccess.php?emailVerified=1&amp;UserAddress2=Ensenada_Reef& amp;AccessCode=No_Access">Ensenada Reef</a></li>

<li><a href="grantAccess.php?emailVerified=1&amp;UserAddress2=Fairfield_Lodg e&amp;AccessCode=No_Access">Fairfield Lodge</a></li>

<li><a href="grantAccess.php?emailVerified=1&amp;UserAddress2=Millington_Cou rt&amp;AccessCode=No_Access">Millington Court</a></li>

<li><a href="grantAccess.php?emailVerified=1&amp;UserAddress2=Nautica_Houses &amp;AccessCode=No_Access">Nautica la Marina Houses</a></li>

<li><a href="grantAccess.php?emailVerified=1&amp;UserAddress2=Onyx_Mews&amp; AccessCode=No_Access">Onyx Mews</a></li>

<li><a href="grantAccess.php?emailVerified=1&amp;UserAddress2=Quadrangle_Hou se&amp;AccessCode=No_Access">Quadrangle House</a></li>

<li><a href="grantAccess.php?emailVerified=1&amp;UserAddress2=Quartz_House&a mp;AccessCode=No_Access">Quartz House</a></li>

<li><a href="grantAccess.php?emailVerified=1&amp;UserAddress2=Topaz_House&am p;AccessCode=No_Access">Topaz House</a></li>

<li><a href="grantAccess.php?emailVerified=1&amp;UserAddress2=Trujillo_Court &amp;AccessCode=No_Access">Trujillo Court</a></li>


I want to set default values for the variables for all three so if someone manages to view the page without selecting a URL parameter, they will get all valid results.

The default value for variable 'AccessCode' will be 'No_Access' ... Not a problem

The default value for variable 'emailVerified' will be '1' ... Not a problem

But for the variable 'UserAddress2' I need all parameters in the Default value... for example:


$varAddress_rsAwaitingSecureAccess = "Arequipa_Reef, Ensenada_Reef, Fairfield_Lodge, Millington_Court, Nautica_Houses, Onyx_Mews, Quadrangle_House, Quartz_House, Topaz_House, Trujillo_Court,";

if (isset($_GET['UserAddress2'])) {

  $varAddress_rsAwaitingSecureAccess = $_GET['UserAddress2'];


I realise the above is wrong so how can I do this.. ?


Please help.

  • Currently Being Moderated
    Jan 18, 2013 2:13 PM   in reply to Steve Joiner

    The best way to accomplish this is to build the WHERE clause dynamically, or else have a different WHERE clause that you use in these situations. In other words, test the value of the querystring variables and if they are empty,  use a different WHERE clause that does not include the address  condition.


    Also, this question belongs in the app dev forum.

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points