brown2005 Posted May 24, 2006 Share Posted May 24, 2006 Hi i have a table called members and the following fieldsfirstnamemiddlenamelastnameagewhat i want is a table with the ages and then the number of people in members in that age with the same names as me....i.e.age - firstname - middlename - lastname18 - 6 - 4 - 121 - 12 - 6 - 15and so on....any ideas please...? Quote Link to comment https://forums.phpfreaks.com/topic/10353-multiple-ranking-tables-in-one-query/ Share on other sites More sharing options...
markduce Posted May 24, 2006 Share Posted May 24, 2006 $firstname="Mark";$middlename="David";$lastname="Duce";$times=100;$x=1;echo "<table><tr><th>Age</th><th>First Name</th><th>Surname</th></tr>";while ($x<$times) {$countfirst=mysql_num_rows(mysql_query("SELECT * FROM members WHERE firstname='$firstname'"));$countmiddle=mysql_num_rows(mysql_query("SELECT * FROM members WHERE middlename='$middlename'"));$countsecond=mysql_num_rows(mysql_query("SELECT * FROM members WHERE lastname='$lastname'"));echo "<tr><td>".$x."</td><td>";echo "".$countfirst."</td><td>".$countmiddle."</td><td>".$countsecond."</td></tr>";$x++;}echo "</table>"; Quote Link to comment https://forums.phpfreaks.com/topic/10353-multiple-ranking-tables-in-one-query/#findComment-38592 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.