Jump to content

Quick Question


Ell20

Recommended Posts

Hi,

 

Im having a bit of trouble with the following query:

 

$query = "SELECT colour, COUNT(colour),player_id,type, crews.id AS cid FROM dom_london INNER JOIN crews ON dom_london.colour = crews.crewcolour WHERE colour != 'ffffff' GROUP BY colour ORDER BY COUNT(colour) DESC LIMIT 3";
$result = mysql_query($query);
$a = 1;
while ($row = mysql_fetch_assoc($result)) {
$winner.$a = $row['cid'];
$a++;
}
echo $winner1.'<br>';
echo $winner2.'<br>';
echo $winner3.'<br>';

 

I am not getting any errors, its making the space for the echoing of the statements but its not actually displaying anything.

The main part im unsure about is "crews.id AS cid", is this the correct way to put the column name if there is the same column name in the two tables which are being joined?

 

Any help is appreciated

 

Elliot

Link to comment
https://forums.phpfreaks.com/topic/116391-quick-question/
Share on other sites

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.