Jump to content

Recommended Posts

OK...the DB is valid and the page on first load shows all records (like it is supposed to), but the SEARCH form does not work. Can anyone explain why?

 

 

<?php
if (isset($_GET['S_homeTeam']) && $_GET['S_homeTeam'] == "") {
  $_GET['S_homeTeam'] = "-1";
}
?>
<?php
if (isset($_GET['S_rainout'])) {
  $_GET['S_rainout'] = "1";
}
?>
<?php
if (!session_id()) session_start();
if (isset($_SESSION["ALFL_Results_QueryString"]) && ($_SESSION["ALFL_Results_QueryString"] != "") && !isset($_SERVER["QUERY_STRING"]) ){
header("Location: ALFL_Schedule.php?".str_replace("&totalRows_","&old_totalRows_",$_SESSION["ALFL_Results_QueryString"]));
}
else{$_SESSION["ALFL_Results_QueryString"] = isset($_SERVER["QUERY_STRING"])?$_SERVER["QUERY_STRING"]:"";
}
?>
<?php
$maxRows_WADAALFL = 20;
$pageNum_WADAALFL = 0;
if (isset($_GET['pageNum_WADAALFL'])) {
  $pageNum_WADAALFL = $_GET['pageNum_WADAALFL'];
}
$startRow_WADAALFL = $pageNum_WADAALFL * $maxRows_WADAALFL;

$ParamvisitorTeam_WADAALFL = "-1";
if (isset($ParamvisitorTeam_WADAALFL)) {
  $ParamvisitorTeam_WADAALFL = (get_magic_quotes_gpc()) ? $_GET['S_homeTeam'] : addslashes($_GET['S_homeTeam']);
}
$ParamhomeTeam_WADAALFL = "-1";
if (isset($_GET['S_homeTeam'])) {
  $ParamhomeTeam_WADAALFL = (get_magic_quotes_gpc()) ? $_GET['S_homeTeam'] : addslashes($_GET['S_homeTeam']);
}
$Paramrainout_WADAALFL = "0";
if (isset($_GET['S_rainout'])) {
  $Paramrainout_WADAALFL = (get_magic_quotes_gpc()) ? $_GET['S_rainout'] : addslashes($_GET['S_rainout']);
}
mysql_select_db($database_schedule, $schedule);
$query_WADAALFL = sprintf("SELECT * FROM ALFL WHERE (visitorTeam LIKE '%%%s%%' OR '-1' = '%s') OR (homeTeam LIKE '%%%s%%' OR '-1' = '%s') OR (rainout = %s OR '0' = '%s') ORDER BY ID ASC", $ParamvisitorTeam_WADAALFL,$ParamvisitorTeam_WADAALFL,$ParamhomeTeam_WADAALFL,$ParamhomeTeam_WADAALFL,$Paramrainout_WADAALFL,$Paramrainout_WADAALFL);
$query_limit_WADAALFL = sprintf("%s LIMIT %d, %d", $query_WADAALFL, $startRow_WADAALFL, $maxRows_WADAALFL);
$WADAALFL = mysql_query($query_limit_WADAALFL, $schedule) or die(mysql_error());
$row_WADAALFL = mysql_fetch_assoc($WADAALFL);

if (isset($_GET['totalRows_WADAALFL'])) {
  $totalRows_WADAALFL = $_GET['totalRows_WADAALFL'];
} else {
  $all_WADAALFL = mysql_query($query_WADAALFL);
  $totalRows_WADAALFL = mysql_num_rows($all_WADAALFL);
}
$totalPages_WADAALFL = ceil($totalRows_WADAALFL/$maxRows_WADAALFL)-1;
?>
<?php
$queryString_WADAALFL = "";
if (!empty($_SERVER['QUERY_STRING'])) {
  $params = explode("&", $_SERVER['QUERY_STRING']);
  $newParams = array();
  foreach ($params as $param) {
    if (stristr($param, "pageNum_WADAALFL") == false && 
        stristr($param, "totalRows_WADAALFL") == false) {
      array_push($newParams, $param);
    }
  }
  if (count($newParams) != 0) {
    $queryString_WADAALFL = "&" . htmlentities(implode("&", $newParams));
  }
}
$queryString_WADAALFL = sprintf("&totalRows_WADAALFL=%d%s", $totalRows_WADAALFL, $queryString_WADAALFL);
?>
<?php
//WA AltClass Iterator
class WA_AltClassIterator     {
  var $DisplayIndex;
  var $DisplayArray;
  
  function WA_AltClassIterator($theDisplayArray = array(1)) {
    $this->ClassCounter = 0;
    $this->ClassArray   = $theDisplayArray;
  }
  
  function getClass($incrementClass)  {
    if (sizeof($this->ClassArray) == 0) return "";
  	if ($incrementClass) {
      if ($this->ClassCounter >= sizeof($this->ClassArray)) $this->ClassCounter = 0;
      $this->ClassCounter++;
    }
    if ($this->ClassCounter > 0)
      return $this->ClassArray[$this->ClassCounter-1];
    else
      return $this->ClassArray[0];
  }
}
?><?php
//WA Alternating Class
$WARRT_AltClass1 = new WA_AltClassIterator(explode("|", "WADAResultsRowDark|"));
?>

<head>
<!-- Copyright 2005 Macromedia, Inc. All rights reserved. -->
<!-- InstanceBeginEditable name="doctitle" -->
<title>Results ALFL</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="mm_training.css" type="text/css" />
<style type="text/css">
<!--
.style1 {
color: #FF0000;
font-style: italic;
font-weight: bold;
font-size: 36px;
}
.style2 {font-size: 28px}
.style9 {
font-size: large;
font-weight: bold;
}
.style21 {color: #FFCC00; font-size: 24px;}
.style22 {color: #D3DCE6}
.style24 {color: #FF0000}
-->
</style>
<!-- InstanceEndEditable -->
<meta name="keywords" content="airdrie,slo-pitch,fastball,alberta, SPN, NSA,easton bats, worth bats,slo-pitch bats,baseball bats,slopitch,softball,baseball,sports,chinook winds," />
<meta name="description" content="mixed slopitch, men's slopitch, ladies fastball leagues,Slopitch in airdrie,airdrie slopitch, airdrie sports, recreation in airdrie,alberta slopitch,alberta fastball" />
<!-- InstanceBeginEditable name="head" -->
<link href="WA_DataAssist/styles/Refined_Pacifica.css" rel="stylesheet" type="text/css" />
<link href="WA_DataAssist/styles/Arial.css" rel="stylesheet" type="text/css" />
<!-- InstanceEndEditable -->
</head>
<body bgcolor="#26354A">
<table width="100%" border="0" cellpadding="0" cellspacing="0" bordercolor="#26354A">
<tr bgcolor="#26354A">
<td width="20" nowrap="nowrap"><img src="mm_spacer.gif" alt="" width="20" height="1" border="0" /></td>
<td width="100%" height="70" align="left" nowrap="nowrap" bgcolor="#26354A" class="logo"><span class="style2">CHINOOK WINDS</span> <span class="style1">XTRA</span> <span class="tagline">| online community for CHINOOK WINDS supporters <img src="images/leaf.gif" width="48" height="42" /></span></td>
</tr>

<tr bgcolor="#FF6600">
<td colspan="4"><img src="mm_spacer.gif" alt="" width="1" height="4" border="0" /></td>
</tr>

<tr bgcolor="#D3DCE6">
<td colspan="4"><img src="mm_spacer.gif" alt="" width="1" height="1" border="0" /></td>
</tr>

<tr bgcolor="#FFCC00">
<td width="20" nowrap="nowrap"> </td>
<td height="24" colspan="3" bgcolor="#FFCC00">
<table border="0" cellpadding="0" cellspacing="0" id="navigation">
        <tr>
          <td class="navText" align="center" nowrap="nowrap"><a href="history.html">OUR HISTORY </a></td>
          <td class="navText" align="center" nowrap="nowrap"><a href="facility.html">THE FACILITY </a></td>
          <td class="navText" align="center" nowrap="nowrap"><a href="leagues.html">LEAGUES</a></td>
          <td class="navText" align="center" nowrap="nowrap"><a href="http://www.chinookwindsxtra.org/forum/index.php" target="_blank">XTRA FORUM</a><a href="javascript:;"></a></td>
          <td class="navText" align="center" nowrap="nowrap"><a href="sponsors.html">SPONSORS</a></td>
	  <td class="navText" align="center" nowrap="nowrap"><a href="index.html">HOME</a></td>
    </tr>
      </table>	</td>
</tr>

<tr bgcolor="#D3DCE6">
<td colspan="4"><img src="mm_spacer.gif" alt="" width="1" height="1" border="0" /></td>
</tr>

<tr bgcolor="#FF6600">
<td colspan="4"><img src="mm_spacer.gif" alt="" width="1" height="4" border="0" /></td>
</tr>

<tr bgcolor="#D3DCE6">
<td colspan="4"><img src="mm_spacer.gif" alt="" width="1" height="1" border="0" /></td>
</tr>

<tr bgcolor="#26354A">
<td colspan="4"> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="230" height="286" valign="top"><img src="images/index%20logo.gif" alt="CWXlogo" width="230" height="286" /></td>
    <td width="5" rowspan="5"> </td>
    <td rowspan="5" align="left" valign="top" bgcolor="#D3DCE6"><table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" bordercolor="#96007B">
            <tr>
              <td height="1" colspan="2" align="center" bordercolor="#D3DCE6" bgcolor="#FFFFFF"><img src="images/mm_spacer.gif" width="1" height="1" /></td>
              <td width="230" rowspan="6" align="left" valign="top" bgcolor="#26354A"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td align="center" bordercolor="#26354A" bgcolor="#26354A"></td>
                </tr>
                </table>
              <p class="sidebarText style8 style9"> </p></td>
            </tr>
        <tr>
        <td height="39" colspan="2" align="center" bordercolor="#D3DCE6" bgcolor="#96007B" class="style21"><!-- InstanceBeginEditable name="EditRegion4" -->
          <p>Select Your Team  </p>
        <!-- InstanceEndEditable --></td>
        </tr>
      <tr>
        <td height="1" colspan="2" align="center" bordercolor="#D3DCE6" bgcolor="#FFFFFF"><img src="images/mm_spacer.gif" width="1" height="1" /></td>
      </tr>
      <tr>
        <td width="141" bordercolor="#D3DCE6" bgcolor="#D3DCE6"> </td>
        <td width="399" bordercolor="#D3DCE6" bgcolor="#D3DCE6"> </td>
      </tr>
      <tr>

**body**
            
            
            <div class="WADASearchContainer">
              <form action="ALFL_Schedule.php" method="get" name="WADASearchForm" id="WADASearchForm">
                <div class="WADAHeader">Search</div>
                <div class="WADAHorizLine"><img src="WA_DataAssist/images/Pacifica/Refined_tx.gif" alt="" height="1" width="1" border="0" /></div>
                <table class="WADADataTable" cellpadding="0" cellspacing="0" border="0">
                  <tr>
                    <th class="WADADataTableHeader">homeTeam:</th>
                    <td class="WADADataTableCell"><input type="text" name="S_homeTeam" id="S_homeTeam" value="" size="32" /></td>
                  </tr>
                  <tr>
                    <th class="WADADataTableHeader">rainout:</th>
                    <td class="WADADataTableCell"><input type="checkbox" name="S_rainout" id="S_rainout" value="1" /></td>
                  </tr>
                </table>
                <div class="WADAHorizLine"><img src="WA_DataAssist/images/Pacifica/Refined_tx.gif" alt="" height="1" width="1" border="0" /></div>
                <div class="WADAButtonRow">
                  <table class="WADADataNavButtons" border="0" cellpadding="0" cellspacing="0">
                    <tr>
                      <td class="WADADataNavButtonCell" nowrap="nowrap"><input type="image" hspace="0" vspace="0" border="0" name="Search" id="Search" value="Search" alt="Search" src="WA_DataAssist/images/Pacifica/Refined_search.gif"  /></td>
                    </tr>
                  </table>
                </div>
              </form>

Link to comment
https://forums.phpfreaks.com/topic/90607-why-dont-this-work/
Share on other sites

Try

<?php $query_WADAALFL = sprintf("SELECT * FROM ALFL WHERE visitorTeam LIKE '%%%s%%' OR '-1' = '%s' OR homeTeam LIKE '%%%s%%' OR '-1' = '%s' OR rainout = %s OR '0' = '%s' ORDER BY ID ASC", $ParamvisitorTeam_WADAALFL,$ParamvisitorTeam_WADAALFL,$ParamhomeTeam_WADAALFL,$ParamhomeTeam_WADAALFL,$Paramrainout_WADAALFL,$Paramrainout_WADAALFL; ?>

Link to comment
https://forums.phpfreaks.com/topic/90607-why-dont-this-work/#findComment-464539
Share on other sites

Thanks MAXUDASKIN  ;) That worked ...sort of...

Still one minor glitch...The search only pulls results if BOTH the textfield is entered and the checkbox selected. I would like it to search as EITHER the textfield or the checkbox are used...or BOTH are used...

eg..search for YANKEES to get their schedule or search for YANKEES and <rainouts> for their raindelayed games or search for just <rainouts> for the entire league.

Is that possible to do?

Link to comment
https://forums.phpfreaks.com/topic/90607-why-dont-this-work/#findComment-464561
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.