Assuming that you get your data out of the database (MySQL?)with something like
$sql = "SELECT name, genre FROM games ORDER BY genre";
$result = mysql_query($sql);
while($data = mysql_fetch_assoc($result)){
if($data['genre'] == "action"){
print ....
}
}
But then you might as well use the Genre column directly:
$sql = "SELECT name, genre FROM games ORDER BY genre";
$result = mysql_query($sql);
while($data = mysql_fetch_assoc($result)){
print($data['name']." (".ucfirst($data['genre']).")";
}