Jump to content

Query duplicate results


Caffeinenyx

Recommended Posts

$PlayerQuery = "SELECT FirstName, SurName FROM players p, rounds m, entrants e, games t WHERE p.PlayerID = e.PlayerID AND m.GameID = '$ID' AND e.EntrantID = m.Player";
	$PlayerResult = mysql_query($PlayerQuery);
	$PlayerRow = mysql_num_rows($PlayerResult);

 

Can someone suggest why this returns game*the number of results. For each new game it returns an extra duplicate result. For example for 2 games:

j Smith

j Smith

t John

t John etc

 

There are no duplicate entry's! and results should be unique.  Not in a loop (positive)

Link to comment
https://forums.phpfreaks.com/topic/235706-query-duplicate-results/
Share on other sites

Because your pulling 2 rows, for example

if i have 2 tables

Table A has 1 record

Table B has 3 records

 

if i link them and display only for table A i would get the same result 3 times,

change FirstName, SurName  to * and review the details,

without knowing my details about the database its kinda hard to say!

but it's likely you are returning 2 more data that you need/want

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.