close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Basic Search Form

Thread began 7/21/2014 12:43 am by Jason | Last modified 8/28/2014 10:46 am by Jason | 3967 views | 101 replies


If you take a look at the screen shots I sent in my last message you'll notice the search is for last name of brown, but it returns all the results in the Mike Stephens DC, but a search for the first name of jason only returns 1 result in the mike stephens dc.

I changed the id to dc and it did cause the drop down to have an effect, however all of the choices except for 1 seem to return the same 3 results as in the screen shot of the search for the last name brown.

debug script is:
SELECT pcms2_users.UserID, pcms2_users.UserFirstName, pcms2_users.UserLastName, dc.dc FROM pcms2_users INNER JOIN small_group ON pcms2_users.SmallGroup = INNER JOIN dc ON small_group.dc = WHERE (pcms2_users.UserFirstName = '-1' OR -1 = -1) AND (pcms2_users.UserLastName = -1 OR -1 = -1) AND (dc.dc = Mike Stephens OR Mike Stephens = -1)

current page code is:

<?php require_once('Connections/local_i.php'); ?>
<?php require_once('webassist/mysqli/rsobj.php'); ?>
$DC = new WA_MySQLi_RS("DC",$local_i,0);
$DC->setQuery("SELECT dc.dc FROM dc");
$Day = new WA_MySQLi_RS("Day",$local_i,1);
$Day->setQuery("SELECT, FROM day");
$ServingQuery = new WA_MySQLi_RS("ServingQuery",$local_i,0);
$ServingQuery->setQuery("SELECT pcms2_users.UserID, pcms2_users.UserFirstName, pcms2_users.UserLastName, dc.dc FROM pcms2_users INNER JOIN small_group ON pcms2_users.SmallGroup = INNER JOIN dc ON small_group.dc = WHERE (pcms2_users.UserFirstName = ? OR ? = -1) AND (pcms2_users.UserLastName = ? OR ? = -1) AND (dc.dc = ? OR ? = -1)");
$ServingQuery->bindParam("s", "".(isset($_GET['UserFirstName'])?$_GET['UserFirstName']:"") ."", "-1"); //paramFirstName1
$ServingQuery->bindParam("i", "".(isset($_GET['UserFirstName'])?$_GET['UserFirstName']:"") ."", "-1"); //paramFirstName2
$ServingQuery->bindParam("i", "".(isset($_GET['UserLastName'])?$_GET['UserLastName']:"") ."", "-1"); //paramLastName1
$ServingQuery->bindParam("i", "".(isset($_GET['UserLastName'])?$_GET['UserLastName']:"") ."", "-1"); //paramLastName2
$ServingQuery->bindParam("i", "".(isset($_GET['DC'])?$_GET['DC']:"") ."", "-1"); //paramDC1
$ServingQuery->bindParam("i", "".(isset($_GET['DC'])?$_GET['DC']:"") ."", "-1"); //paramDC2
<!doctype html>
<link href="stylesheets/reset.css" rel="stylesheet" type="text/css" />
<meta charset="utf-8" />
<title>Untitled Document</title>
<script type="text/javascript" src="scripts/browser-compatibility.js"></script>
<link href="stylesheets/layout-css-4.css" rel="stylesheet" type="text/css" />
<?php echo($ServingQuery->debugSQL()); ?>
<form method="get">
<input type="search" name="UserFirstName" id="UserFirstName">
<input type="search" name="UserLastName" id="UserLastName">
<select name="DC" id="DC">
while(!$DC->atEnd()) { //dyn select
<option value="<?php echo($DC->getColumnVal("dc")); ?>">
<?php echo($DC->getColumnVal("dc")); ?>
} //dyn select
<input type="submit" name="search" value="search">
<?php if((isset($_GET['UserFirstName']) && $_GET['UserFirstName'] != "") OR (isset($_GET['UserLastName']) && $_GET['UserLastName'] != "") OR (isset($_GET['DC']) && $_GET['DC'] != "")) { ?>
while(!$ServingQuery->atEnd()) {
$_GET['UserID'] = $ServingQuery->getColumnVal("UserID");
<table width="100%" border="1">
<td align="center">First Name</td>
<td align="center">Last Name</td>
<td width="20%" align="center">DC</td>
<td width="20%" align="center">Serving Areas</td>
<td align="center" class="customClass"><a href="pcms2_users_detail.php?UserID=<?php echo($ServingQuery->getColumnVal("UserID")); ?>"><?php echo($ServingQuery->getColumnVal("UserFirstName")); ?></a>
<td align="center">
<?php echo($ServingQuery->getColumnVal("UserLastName")); ?>
<td width="20%" align="center">
<?php echo($ServingQuery->getColumnVal("dc")); ?>
$CleaningTeamQuery = new WA_MySQLi_RS("CleaningTeamQuery",$local_i,1);
$CleaningTeamQuery->setQuery("SELECT serving_team.*, cleaning_team_shifts.* FROM serving_team INNER JOIN cleaning_team_shifts ON = cleaning_team_shifts.cleaning_team_id WHERE cleaning_team_shifts.cleaning_team_volunteer = ?");
$CleaningTeamQuery->bindParam("s", "".($ServingQuery->getColumnVal("UserID")) ."", "-1"); //WAQB_Param1
$KidsProgramQuery = new WA_MySQLi_RS("KidsProgramQuery",$local_i,1);
$KidsProgramQuery->setQuery("SELECT serving_team.*, kids_program_shifts.* FROM serving_team LEFT OUTER JOIN kids_program_shifts ON = kids_program_shifts.kids_program_team_id WHERE kids_program_shifts.kids_program_volunteer = ?");
$KidsProgramQuery->bindParam("s", "".($ServingQuery->getColumnVal("UserID")) ."", "-1"); //WAQB_Param1
$YouthProgramQuery = new WA_MySQLi_RS("YouthProgramQuery",$local_i,1);
$YouthProgramQuery->setQuery("SELECT serving_team.*, youth_program_shifts.* FROM serving_team INNER JOIN youth_program_shifts ON = youth_program_shifts.yp_team_id WHERE youth_program_shifts.yp_volunteer = ?");
$YouthProgramQuery->bindParam("s", "".($ServingQuery->getColumnVal("UserID")) ."", "-1"); //WAQB_Param1
$ITTeamQuery = new WA_MySQLi_RS("ITTeamQuery",$local_i,1);
$ITTeamQuery->setQuery("SELECT serving_team.*, it_team_shifts.* FROM serving_team INNER JOIN it_team_shifts ON = it_team_shifts.it_team_id WHERE it_team_shifts.it_volunteer = ?");
$ITTeamQuery->bindParam("i", "".($ServingQuery->getColumnVal("UserID")) ."", "-1"); //WAQB_Param1
$ClericalTeamQuery = new WA_MySQLi_RS("ClericalTeamQuery",$local_i,1);
$ClericalTeamQuery->setQuery("SELECT serving_team.*, clerical_team_shifts.* FROM serving_team INNER JOIN clerical_team_shifts ON = clerical_team_shifts.clerical_team_id WHERE clerical_team_shifts.clerical_volunteer = ?");
$ClericalTeamQuery->bindParam("i", "".($ServingQuery->getColumnVal("UserID")) ."", "-1"); //WAQB_Param1
$WorshipTeamQuery = new WA_MySQLi_RS("WorshipTeamQuery",$local_i,1);
$WorshipTeamQuery->setQuery("SELECT serving_team.*, worship_team_shifts.* FROM serving_team INNER JOIN worship_team_shifts ON = worship_team_shifts.worship_team_id WHERE worship_team_shifts.worship_volunteer = ?");
$WorshipTeamQuery->bindParam("i", "".($ServingQuery->getColumnVal("UserID")) ."", "-1"); //WAQB_Param1
$HospitalityTeamQuery = new WA_MySQLi_RS("HospitalityTeamQuery",$local_i,1);
$HospitalityTeamQuery->setQuery("SELECT serving_team.*, hospitality_team_shifts.* FROM serving_team INNER JOIN hospitality_team_shifts ON = hospitality_team_shifts.hospitality_team_id WHERE hospitality_team_shifts.hospitality_volunteer = ?");
$HospitalityTeamQuery->bindParam("i", "".($ServingQuery->getColumnVal("UserID")) ."", "-1"); //WAQB_Param1
<td width="20%" align="center">
<?php echo($CleaningTeamQuery->getColumnVal("team")); ?>
<?php echo($KidsProgramQuery->getColumnVal("team")); ?>
<?php echo($YouthProgramQuery->getColumnVal("team")); ?>
<?php echo($ITTeamQuery->getColumnVal("team")); ?>
<?php echo($ClericalTeamQuery->getColumnVal("team")); ?>
<?php echo($WorshipTeamQuery->getColumnVal("team")); ?>
<?php echo($HospitalityTeamQuery->getColumnVal("team")); ?>
<div class="row_1"></div>
$ServingQuery->moveFirst(); //return RS to first record
<?php } ?>


Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question





Ease of use


security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...