MySQL Forums
Forum List  »  PHP

SELECT
Posted by: Edward Brim
Date: September 22, 2005 08:29AM

Any help will be greatly appreciated.

I have at MYSQL table called "results" w/ the following fields:

tournaments / team / participants / fish / weight / lunker

Lake1 / team1 / participants1 / fish1 / weight1 / lunker1
Lake1 / team2 / participants1 / fish1 / weight1 / lunker1
Lake1 / team3 / / fish2 / weight2 / lunker2
Lake1 / team4 / / fish3 / weight3 / lunker2

Here is some of my code:

<?
$tournament = $_POST['tournament'];
$result = mysql_query("SELECT team, participants, fish, weight, lunker, FROM results WHERE tournament = '$tournament' ORDER BY weight DESC ") or die(mysql_error());
echo ",h1 align='center'>$tournament<br></h1>";
echo "<table bgcolor-#000099 align=center border='1' cellpadding='2' cellspacing='0' width='600'>";
echo "<tr> <th>Team</th> <th>Fish</th><th>Weight</th><th>Lunker</th></tr>";
while($row = mysql_fetch_array( $result )) {
echo "<tr>";
echo "<td align='center'>";
if ($row['participants'] == '') echo $row['team'];
else echo $row['participants'];


The problem is that the table has duplicates in the participants field so the results display are misleading show participants two times.

The results display as follows:

Lake1 / team1 / participants1 / fish1 / weight1 / lunker1
Lake1 / team2 / participants1 / fish1 / weight1 / lunker1
Lake1 / team3 / / fish2 / weight2 / lunker2
Lake1 / team4 / / fish3 / weight3 / lunker2

I would like the results to display like this:

Lake1 / team2 / participants1 / fish1 / weight1 / lunker1
Lake1 / team3 / / fish2 / weight2 / lunker2
Lake1 / team4 / / fish3 / weight3 / lunker2



Thanks in advance for your help.

Options: ReplyQuote


Subject
Written By
Posted
SELECT
September 22, 2005 08:29AM
September 22, 2005 12:28PM
September 22, 2005 01:08PM


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.