<?php
/*
 * Million Dollar Script Two
 *
 * @author      Ryan Rhode
 * @copyright   (C) 2025, Ryan Rhode
 * @license     https://opensource.org/licenses/GPL-3.0 GNU General Public License, version 3
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 *
 *    Million Dollar Script
 *    Pixels to Profit: Ignite Your Revolution
 *    https://milliondollarscript.com/
 *
 */

defined( 'ABSPATH' ) or exit;

global $f2, $wpdb;

$BID = $f2->bid();

$sql = "select * from " . MDS_DB_PREFIX . "banners where banner_id=" . intval( $BID );
$b_row = $wpdb->get_row( $sql, ARRAY_A );

$sql = "select block_id, status, user_id, url, alt_text FROM " . MDS_DB_PREFIX . "blocks where  status='sold' AND banner_id=" . intval( $BID );
$result = $wpdb->get_results( $sql, ARRAY_A );
$blocks = array();
$owners = array();
foreach ( $result as $row ) {
	$blocks[ $row['block_id'] ] = $row['status'];
	$owners[ $row['block_id'] ] = $row['user_id'];
}
?>
The image:
<table border="0" cellpadding=0 cellspacing=0>
    <tr>
        <td nowrap>
			<?php

			for ( $i = 0; $i < $b_row['grid_height']; $i ++ ) {
				for ( $j = 0; $j < $b_row['grid_width']; $j ++ ) {

					switch ( $blocks[ $cell ] ) {

						case 'sold':

							echo '<img style="cursor: pointer;cursor: hand;"  src="' . esc_url( admin_url( 'admin.php?page=mds-' ) ) . 'get-image&amp;block_id=' . $cell . '" width="10" height="10">';

							break;

						case '':
							echo "<img src='images/block.png'>";
					}

					$cell ++;
				}
				echo "<br>";
			}

			?>
        </td>
    </tr>
</table>
