Jump to content

multiple query question


peterbarone

Recommended Posts

Hello can some one help me figure this out. I have to querys that I'm looking to combine them to get one result. Team Name and Points

[code]
<?php
include 'config.php';

$result = mysql_query("SELECT *, sum(points) AS points FROM teams,teamscores WHERE teams.teamid = teamscores.team

GROUP BY teamscores.team")
        
or die("SELECT Error: ".mysql_error());
while($row = mysql_fetch_array( $result )) {
print"<table width=\"650px\">";
print"<tr><td>
$row[teamname]</td><td>$row[points]</td></tr>";
print"</table>";
}
?>

<?php
include 'config.php';

$result = mysql_query("SELECT *, sum(points) AS points FROM playerpoints,players WHERE players.playerid =

playerpoints.player GROUP BY player  ORDER BY   points DESC ")
or die("SELECT Error: ".mysql_error());
while($row = mysql_fetch_array( $result )) {
print"<table width=\"650px\">";
print"<tr><td>
$row[playername]</td><td>$row[points]</td></tr>";
print"</table>";
}
?>
[/code]

Right now both return a running points total but I need them to be combined into one total for points
Link to comment
https://forums.phpfreaks.com/topic/6921-multiple-query-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.