I am trying to narrow search results for a game I'm playing.
I am trying to narrow down my search results by clicking on a particular user that is displayed. Once the user is clicked it need to show all database entries for that user.
For example.
My dbase fields are :- Alliance, User, Might
When I search for 'Alliance', I currently get a list of all users in that alliance
I want to then click on a particular 'user' and only show the results for that user
This is what I have so far
<?php
mysql_connect ("localhost","my username","password") or die (mysql_error());
mysql_select_db ("my_dbase");
$term = $_POST['term'];
$data = mysql_query("select * FROM my_table WHERE alliance like '%$term%' ORDER BY type, alliance, might DESC");
echo "<table border='1' cellpadding='5'>";
echo "<tr> <th>Alliance</th> <th>User</th> <th>Might</th> </tr>";
// loop through results of database query, displaying them in the table
while($row = mysql_fetch_array( $data )) {
// echo out the contents of each row into a table
echo "<tr>";
echo '<td>' . $row['alliance'] . '</td>';
echo '<td>' . $row['user'] . '</td>';
echo '<td>' . $row['might'] . '</td>';
echo "</tr>";
}
// close table>
echo "</table>";
?>
Any help would be fantastic.