seany123 Posted April 24, 2009 Share Posted April 24, 2009 i have a table in my database called players... inside players i have a value called "prison" basically i wanna know how to echo the amount of players have prison >= 1. Quote Link to comment https://forums.phpfreaks.com/topic/155507-solved-help/ Share on other sites More sharing options...
revraz Posted April 24, 2009 Share Posted April 24, 2009 What is the field name that holds the "prison" data? Just do a SELECT COUNT on the table where your field name = "prison" Quote Link to comment https://forums.phpfreaks.com/topic/155507-solved-help/#findComment-818263 Share on other sites More sharing options...
jonsjava Posted April 24, 2009 Share Posted April 24, 2009 SELECT COUNT(`prison`) as `total_in_jail` FROM `players` WHERE `prison` >= 1; Quote Link to comment https://forums.phpfreaks.com/topic/155507-solved-help/#findComment-818264 Share on other sites More sharing options...
premiso Posted April 24, 2009 Share Posted April 24, 2009 $sql = "SELECT COUNT(prison) FROM players WHERE prison > 0"; $result = mysql_query($sql); $prisonCount = mysql_result($result, 0, 0); echo $prisonCount . "<br />"; Basic PHP and MySQL, I would suggest reading a tutorial on that. Quote Link to comment https://forums.phpfreaks.com/topic/155507-solved-help/#findComment-818265 Share on other sites More sharing options...
mtoynbee Posted April 24, 2009 Share Posted April 24, 2009 SELECT COUNT(*) AS player_count FROM players WHERE prison >= 1 Quote Link to comment https://forums.phpfreaks.com/topic/155507-solved-help/#findComment-818266 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.