grlayouts Posted November 5, 2010 Share Posted November 5, 2010 hey Guys I have a table in a db that stores attack details for my game below id attacker win defender time deleted 1 17 1 84 1288576720 0 2 22 1 84 1288576989 0 i want to give a stat like, total attacks made : 20 (times there id is attacker) percent successful = 20% (if win =1 its a win =0 its a loss) and the same with times attacked. I was thinking along the lines of getting the info using $stat = mysql_fetch_array(mysql_query("select * from attacklog where attacker='$userid' AND win='1'")); would i just do that for every option in the database? Link to comment https://forums.phpfreaks.com/topic/217848-take-from-mysql/ Share on other sites More sharing options...
litebearer Posted November 5, 2010 Share Posted November 5, 2010 look into Group Link to comment https://forums.phpfreaks.com/topic/217848-take-from-mysql/#findComment-1130681 Share on other sites More sharing options...
grlayouts Posted November 5, 2010 Author Share Posted November 5, 2010 im not sure i could group them together, as the outcomes are different ie won, lost, attacker defender. or would i just do it 4 times? Link to comment https://forums.phpfreaks.com/topic/217848-take-from-mysql/#findComment-1130685 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.