<main>

    <section class="featured">
      <h2>Search results for:</h2>
      <h5><?php echo $_GET['searchKeyword']; ?></h5><br>
      <div class="game-list">
          
          <?php $sql  = $pdo->query("SELECT * FROM zon_games WHERE game_name LIKE '%".$_GET['searchKeyword']."%'")or die(print_r($pdo->errorInfo(), true)); ?>
          <?php 
          if($sql->rowCount() == 0)
          {
              echo "<div class='alert alert-warning text-nowrap'>Search results not found! try another search keyword.</div>";
          }
          ?>
        <?php while($data = $sql->fetch(PDO::FETCH_ASSOC)){ ?>
          
        <div class="game-card" onclick="location.href='<?php echo BASE_URL; ?>/games/<?php echo $data['game_slug']; ?>';" role="button">
            <?php $image_path = (empty($data['game_image_url'])) ? "" . BASE_URL . "/img/default-bg.png" : "".$data['game_image_url']; ?>
          <img src="<?php echo $image_path; ?>" alt="" />
          <h3><?php echo $data['game_name']; ?></h3>
        </div>
        
        <?php } ?>
        
      </div>
    </section>
    
    <section class="game-list-horizontal">
  <h2>Recommended Games</h2>
  <div class="game-row">
      
      <?php $sql  = $pdo->query("SELECT * FROM zon_games ORDER BY view DESC LIMIT 8")or die(print_r($pdo->errorInfo(), true)); ?>
                    <?php while($data = $sql->fetch(PDO::FETCH_ASSOC)){ ?>
      
    <div class="game-card-horizontal">
        <?php $image_path = (empty($data['game_image_url'])) ? "" . BASE_URL . "/img/default-bg.png" : "".$data['game_image_url']; ?>
      <img src="<?php echo $image_path; ?>" alt="" />
      <div class="game-info">
        <h3><?php echo $data['game_name']; ?></h3>
        <p><?php echo limit_word($data['game_description'],10); ?> ...</p>
        <a href="<?php echo BASE_URL; ?>/games/<?php echo $data['game_slug']; ?>" class="play-button">Play Now</a>
      </div>
    </div>

    <?php } ?>
    
  </div>
</section>

    
  </main>