Sql help for soccer stats
3 posts by 1 authors in: Forums > CMS Builder
Last Post: August 27, 2022 (RSS)
By mbareara - August 27, 2022 - edited: August 27, 2022
Goodmorning and thank you in advance for your help
I have two tables cms_players and cms_matches
in cms_matches i have a pillbox list field ‘yellow_card’ in which i select players that receive yellow card for each match (SELECT num, CONCAT(surname," ",name) FROM `<?php echo $TABLE_PREFIX ?>players` ORDER BY surname ASC)
Now, i have a page for each player and i would "count” number of yellow cards received from this player.
Could you help me?
By mbareara - August 27, 2022
If it wasn't a multivalue field i could use this code:
<?php $matchesPlayed = mysql_count("matches", "players_matches = " . intval($playersRecord['num']) ) ;?><?php echo $matchesPlayed;?>
By mbareara - August 27, 2022
I've solved it searching on this forum
<?php $matchesPlayed = mysql_count("matches", "players LIKE '%\t".$playersRecord['num']."\t%'") ;?><?php echo $matches_played;?>