Jump to content

Query Problem


ttocskcaj

Recommended Posts

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

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

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.