gere06 Posted July 13, 2008 Share Posted July 13, 2008 <? include("/home/content/g/e/r/gereb/html/ps3t/config22.php"); $trophies=mysql_query("SELECT userid,var FROM playertrophy WHERE userid=1 "); $trophies=count($var); echo"$trophies"; ?> What i want to to id count all the elements in the array and get a total so if the array is (1,2,3,4,5,6) i want the out put to be total=6 Link to comment https://forums.phpfreaks.com/topic/114580-count-total-number-of-elements-in-a-array/ Share on other sites More sharing options...
rhodesa Posted July 14, 2008 Share Posted July 14, 2008 <? include("/home/content/g/e/r/gereb/html/ps3t/config22.php"); $result = mysql_query("SELECT COUNT(*) FROM playertrophy WHERE userid=1 "); $row = mysql_fetch_array($result); $count = $row[0]; echo $count; ?> Link to comment https://forums.phpfreaks.com/topic/114580-count-total-number-of-elements-in-a-array/#findComment-589170 Share on other sites More sharing options...
.josh Posted July 14, 2008 Share Posted July 14, 2008 please do not make multiple threads asking the same thing. Link to comment https://forums.phpfreaks.com/topic/114580-count-total-number-of-elements-in-a-array/#findComment-589297 Share on other sites More sharing options...
Recommended Posts