<?php 
   include 'topre.php';
   
    $que = $ks->prepare('SELECT *FROM tbl_tv WHERE tv_sts=1 AND tvid=1');
    $que->execute();
    $fque = $que->fetch();
    $tid = $fque['tvid'];
    $tname = $fque['tv_name'];
    $t_thumb = $fque['thumbnail_tv'];
    
?>
    <!-- ##### Hero Area Start ##### -->
    <section class="hero--area section-padding-80">
        <div class="container">
            <div class="row no-gutters">
                
                <div class="col-12">
                    <div class="sidebar-area">
                        <!-- ***** Single Widget ***** -->
                        <div class="single-widget latest-video-widget mb-50">
                            <!-- Section Heading -->
                            <div class="section-heading style-2 mb-30">
                                <h4>TV Show</h4>
                                <div class="line"></div>
                            </div>

                            <!-- Single Blog Post -->
                            <div class="single-feature-post video-post bg-img" style="background-image: url(img/tv-thumbnail/<?php echo $t_thumb;?>);">
                                <!-- Play Button -->
                                <a href="telvshow?tv=<?php echo $tid;?>" class="btn play-btn"><i class="fa fa-play" aria-hidden="true"></i></a>
                                
                                <div class="post-content">
                                    <a href="telvshow?tv=<?php echo $tid;?>" class="post-cata">TV Live</a>
                                    <a href="telvshow?tv=<?php echo $tid;?>" class="post-title"><?php echo $tname;?></a>
                                </div>

                            </div>
                            <br>
                            <!-- Single TV POST -->
                            <?php
                              $stmtv = $ks->prepare('SELECT *FROM tbl_tv WHERE tv_sts=1 AND tvid!="'.$_REQUEST['tv'].'"');
                              $stmtv->execute();
                              while($roww = $stmtv->fetch()){
                              $tvid = $roww['tvid']; 
                              $tvname = $roww['tv_name']; 
                            ?>
                            <div class="single-blog-post style-3 d-flex mb-50">
                                <div class="post-thumbnail">
                                    <img src="img/tv-thumbnail/<?php echo $roww['thumbnail_tv'];?>" alt="">
                                </div>
                                <div class="post-content">
                                    <a href="telvshow?tv=<?php echo $tvid;?>" class="post-title"><?php echo $tvname;?></a>
                                </div>
                            </div>
                            <?php }?>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
    <!-- ##### Hero Area End ##### -->
    
    <!-- ##### Trending Posts Area Start ##### -->
    <section class="trending-posts-area">
        <div class="container">
            <div class="row">
                <div class="col-12">
                    <!-- Section Heading -->
                    <div class="section-heading">
                        <h4>Trending Videos</h4>
                        <div class="line"></div>
                    </div>
                </div>
            </div>

            <div class="row">
                <?php 
                 $que = $ks->prepare('SELECT *FROM tbl_vds WHERE vd_sts=1 ORDER BY vdid DESC LIMIT 10');
                 $que->execute();
                 while($rrr = $que->fetch()){
                ?>
                <!-- Video Post -->
                <div class="col-12 col-md-4">
                    <div class="single-post-area mb-80">
                        <!-- Post Thumbnail -->
                        <div class="single-video-area">
                            <iframe src="https://www.youtube.com/embed/<?php echo $rrr['linkvd'];?>" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
                         </div>

                        <!-- Post Content -->
                        <div class="post-content">
                            <a class="post-title"><?php echo $rrr['vidName'];?></a>
                        </div>
                    </div>
                </div>
               <?php }?>
            </div>

        </div>
    </section>
    <!-- ##### Trending Posts Area End ##### -->


<?php 
   include 'btmsrc.php';
?>