EOM;
////////////////////////////////////
// get most popular
// how many items to display?
// total is max_across * max_down
$max_across = 2;
$max_down = 8;
$max_items = ($max_across * $max_down);
$query2 ="SELECT * FROM game_list WHERE times_played <> '' AND enabled = '1' ORDER BY times_played DESC LIMIT $max_items";
//print "Q: $query2 ";
$result2 = mysqli_query($dbcon, $query2) or die(mysqli_error());
//print "RESULT: $result2 ";
$cellcounter = 0;
print <<
EOM;
while ($myrow = mysqli_fetch_array($result2)) {
// get the vars
$game_id = trim($myrow['game_id']);
$display_name = trim($myrow['display_name']);
$image_name = trim($myrow['image_name']);
$times_played = trim($myrow['times_played']);
$rating = trim($myrow['rating']);
$ratimg = round($rating) . "stars";
$display_name = preg_replace('|-|', ' ', $display_name);
// correct for missing icons
if($image_name == "stand_in.jpg"){
$image_name = image_picker();
}
print <<
EOM;
$cellcounter++;
$itemcounter++;
if($cellcounter == $max_across){
print " \n";
$cellcounter = 0;
if($itemcounter != $max_items){
print "\n";
}
}
}
if($cellcounter == '1'){print " | | ";}
if($cellcounter == '2'){print " | |
";}
print "