MySQL Forums
Forum List  »  Full-Text Search

Please i need help with searching criteria
Posted by: john mamon
Date: November 02, 2005 02:13PM

Well first of all i have to say i have no idea of what i did wrong but also add that i have really low php and mysql skills. Well the fact is that i was making a search form like the one in http://www.pgtour.net to make the replays of my games searchable. Well following the manuals and tutorials i found i made a code and im able to find acording to 1 criteria the rest wont work. I mean i can search by losers name for example but it wont let me by winners name.
The link to the code in actio is this: http://alderan.al.funpic.de/poop.php

<?php
if(!$c) {
?><style type="text/css">
<!--
body,td,th {
color: #FFFFFF;
}
body {
background-color: #2C333D;
}
-->
</style>
<form action="poop.php?c=1" method=POST>
<p><b>Find replays by : </b><br>
<input type="text" length=40 name="winner">
Winner Nick <br>
<input type="text" length=40 name="loser">
Loser Nick <br>
<input type="text" length=40 name="winrace">
Winner Race <br>
<input type="text" length=40 name="map">
Map <br>
<br>
<input type="submit" value="Buscar">
</p>
</form>
<?
} else if($c) {
MySQL_connect("localhost", "alderan", "mypass");
MySQL_select_db("alderan");
if((!$winner) || ($winner == "")) { $winner = ""; } else { $winner = "+(".$winner.")"; }
$query = "
SELECT player1, player2, races, map,
MATCH(player1) AGAINST ('$winner' IN BOOLEAN MODE) AS score
FROM replays
WHERE MATCH(player1) AGAINST ('$winner' IN BOOLEAN MODE)";
if((!$loser) || ($loser == "")) { $loser = ""; } else { $loser = "+(".$loser.")"; }
$query = "
SELECT player1, player2, races, map,
MATCH(player2) AGAINST ('$loser' IN BOOLEAN MODE) AS score
FROM replays
WHERE MATCH(player2) AGAINST ('$loser' IN BOOLEAN MODE)";
$artm1 = MySQL_query($query);
if(!$artm1) {
echo MySQL_error()."<br>$query<br>";
}
echo "<b>Resultado de la Busqueda</b><br>";
if(MySQL_num_rows($artm1) > 0) {
echo "<table>";
echo "
<tr>
<td>Winner</td>
<td>Loser</td>
<td>Map</td>
<td>Match</td>
<td>Date</td>
<td>Download</td></tr>";
while($artm2 = MySQL_fetch_array($artm1)) {
echo "<td>{$artm2['player1']}</td>";
echo "<td>{$artm2['player2']}</td>";
echo "<td>{$artm2['map']}</td>";
echo "<td>{$artm2['races']}</td>";
echo "<td>{$artm2['date']}</td>";
echo "<td>{$artm2['download']}</td></tr>";
}
echo "</table>";
}
else {
echo "No Results were found in this category.<br>";
}
echo "<br>";
}



Edited 2 time(s). Last edit at 11/02/2005 02:30PM by john mamon.

Options: ReplyQuote


Subject
Views
Written By
Posted
Please i need help with searching criteria
2989
November 02, 2005 02:13PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.