ttocskcaj Posted March 24, 2011 Share Posted March 24, 2011 I have the following database for BigBrother, which is a plugin for CraftBukkit Minecraft server mod. What I want to do is get an array with `player` as the key and the value as the number of rows in the database for that player where action = 0 or 1. id date player action world x y z type data rbacked If that makes sense, what would be the best/most efficient way to do this? Link to comment https://forums.phpfreaks.com/topic/231574-query-problem/ Share on other sites More sharing options...
trq Posted March 24, 2011 Share Posted March 24, 2011 If that makes sense Sorry, none at all. Link to comment https://forums.phpfreaks.com/topic/231574-query-problem/#findComment-1191647 Share on other sites More sharing options...
The Little Guy Posted March 25, 2011 Share Posted March 25, 2011 I think he wants this: $sql = mysql_query("select player, count(*) as total from my_table where action in(0,1) group by player"); while($row = mysql_fetch_assoc($sql)){ echo $row['player']."; Total: ".$row['total']."<br>"; } Link to comment https://forums.phpfreaks.com/topic/231574-query-problem/#findComment-1192058 Share on other sites More sharing options...
ttocskcaj Posted March 27, 2011 Author Share Posted March 27, 2011 I think he wants this: $sql = mysql_query("select player, count(*) as total from my_table where action in(0,1) group by player"); while($row = mysql_fetch_assoc($sql)){ echo $row['player']."; Total: ".$row['total']."<br>"; } Yup that's exactly what I wanted. Thankyou. Link to comment https://forums.phpfreaks.com/topic/231574-query-problem/#findComment-1192752 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.