ok i am back working on my search feature for my games, the problem i am having is i am getting no results back... here is my code:
Code:<?php require ('../../../dbgames_connect.php'); $min=600; foreach (str_split('GFEDCBAXM') as $class) { $classmin[$class] = $min; $classmax[$class] = $min+199; $min+=200; } $classmax['M']="3000"; $classmin['Z']="600"; $classmax['Z']="3000"; if (!$_POST['search']) { ?> <form method="post" style="text-align: center;" action="gamesb.php" target="_self"> Search Games, for help and tips <a href="help.htm" target="_blank">click here</a>.<br> White:<br> First Name: <input name="wFirst" type="text" tabindex="1"><br> Last Name: <input name="wLast" type="text" tabindex="2"><br> Rating: <input name="wRating" type="text" tabindex="3" style="height: 22px" size="8"> OR: <select name="wClass" tabindex="4" style="height: 22px"> <option value="Z" selected="">Select Class</option> <option>G</option> <option>F</option> <option>E</option> <option>D</option> <option>C</option> <option>B</option> <option>A</option> <option value="X">Expert</option> <option value="M">Master+</option> </select><br> <br> Black:<br> First Name: <input name="bFirst" type="text" tabindex="5"><br> Last Name: <input name="bLast" type="text" tabindex="6"><br> Rating: <input name="bRating" type="text" tabindex="7" size="8" style="height: 22px"> OR: <select name="bClass" tabindex="8"> <option value="Z" selected="">Select Class</option> <option>G</option> <option>F</option> <option>E</option> <option>D</option> <option>C</option> <option>B</option> <option>A</option> <option value="X">Expert</option> <option value="M">Master+</option> </select><br> <br> Game Info:<br> Eco: <input name="eco" type="text" tabindex="9" size="6"> (<a target="_blank" href="ecocodes.htm">help</a>)<br> Year: <input name="year" type="text" tabindex="10" size="8"> <select name="result" tabindex="11"> <option value="3">Select Result</option> <option value="1">1-0</option> <option value="0">0-1</option> <option value="2">1/2-1/2</option> </select> <br> <input name="search" type="submit" value="search" tabindex="12"></form> <?php } else { $wValue=$_POST['wClass']; $bValue=$_POST['bClass']; $wRatingmin=$classmin[$wValue]; $wRatingmax=$classmax[$wValue]; $bRatingmin=$classmin[$bValue]; $bRatingmax=$classmax[$bValue]; if ($_POST['wFirst']) {$wFirst=sanitize_lower($_POST['wFirst']); $restraints[]="wFirst LIKE '$wFirst'";} if ($_POST['wLast']) {$wLast=sanitize_lower($_POST['wLast']); $restraints[]="wLast LIKE '$wLast'";} if ($_POST['bFirst']) {$bFirst=sanitize_lower($_POST['bFirst']); $restraints[]="bFirst LIKE '$bFirst'";} if ($_POST['bLast']) {$bLast=sanitize_lower($_POST['bLast']); $restraints[]="bLast LIKE '$bLast'";} if ($_POST['eco']) {$eco=strtoupper(sanitize($_POST['eco'])); $restraints[]="eco LIKE '$eco'";} if ($_POST['year']) {$year=$_POST['year']; $restraints[]="year LIKE '$year'";} if ($_POST['wRating']) {$wRating=$_POST['wRating']; $restraints[]="wRating LIKE '$wRating'";} if ($_POST['bRating']) {$bRating=$_POST['bRating']; $restraints[]="bRating LIKE '$bRating'";} if ($_POST['result']) {$result=$_POST['result']; if($result!=3) { $restraints[]="result LIKE '$result'"; } } $restraints[]="wRating>='{$wRatingmin}'"; $restraints[]="wRating<='{$wRatingmax}'"; $restraints[]="bRating>='{$bRatingmin}'"; $restraints[]="bRating<='{$bRatingmax}'"; $restraints = 'WHERE ' . implode(' AND ', $restraints); echo $restraints; $query = mysql_query("SELECT * FROM games $restraints") or die(mysql_error()); ?> <center> <?php echo "<ol>"; while($row = mysql_fetch_array($query)) { $n = $row['id']; $result = $row['result']; $result = result($result); echo "<li><a href=\"javascript:LoadNextPage($n,1)\" class='game'>".$row['wLast']." (".$row['wRating'].") - ".$row['bLast']." (".$row['bRating'].")<br>"; echo $row['eco']." ".$row['result']."</a></li>"; } echo "</ol>";


LinkBack URL
About LinkBacks
Reply With Quote
icon below! (this is even better than "liking" a post)
i put it as part of another file to be called upon but i didnt require it at the beginning of this one, it works perfectly now 
