I want to ask if is there any faster method how to make this query? Actually it takes about 100 seconds to finish. I have about 10 000 000 (1 GB) rows in a table. This is the statistics generating script.
This is the query:
$results=mysql_query("SELECT * FROM hawkeye WHERE player_id='".$playerID."'") or die("MYSQL ERROR: ".mysql_error());
And then the php code:
$row = mysql_fetch_array($results)
if($row["action"] == 4){$commandcount++;}
else if($row["action"] == 3){$chatcount++;}
else if($row["action"] == 1){$placedcount++;}
else if($row["action"] == 0){$breakcount++;}
else if($row["action"] == 5){$joincount++;}
else if($row["action"] == 6){$quitcount++;}
else if($row["action"] == 7){$qteleportcount++;}
else if($row["action"] == 12){$pvpdeathcount++;}
else if($row["action"] == 21){$mobkillcount++;}
else if($row["action"] == 22){$otherdeathcount++;}
else {}
Thanks for answers!
Use MYSQL to do the math for you. It’s faster then PHP: