<div class="tab-pane <?php if($tab_id==3){ echo 'active';} ?>" id="v-pills-favouritecoupon" role="tabpanel" aria-labelledby="v-pills-favouritecoupon-tab">
   <div class="row">
      <div class="col-lg-12 col-md-12">
         <div class="create-profile-right">
            <div class="card">
               <div class="card-body">
                  <form class="profile-box">
                     <div class="bottom-line">
                        <h6 class="h5 mb-5">Gearbest  coupons of the day</h6>
                     </div>
                     <div class="row">
                        <?php 
                           $user_id=$_SESSION[ADD_TAG.'_UserId_user'];
                                             $limit = 2;  
                            if (isset($_GET["page"])) { 
                              $pn  = $_GET["page"]; 
                            } 
                            else { 
                              $pn=1; 
                            };  
                           
                            $start_from = ($pn-1) * $limit;  
                             $sqlfav = "SELECT * FROM fav_master WHERE user_id='$user_id' AND user_type='user' LIMIT $start_from, $limit  ";
                                 $myqueryfav=$conn->query($sqlfav); 
                           $mydarafav= $myqueryfav->fetchAll()  ;
                           
                           $rows_foundfav = $myqueryfav->rowCount();
                                 foreach( $mydarafav as $rowfav ){
                                     $user_id   = $rowfav["user_id"];
                                    $coupan_id  = $rowfav["coupan_id"];
                           
                            $sqlcou = "SELECT * FROM coupon WHERE rowId='$coupan_id' ";  
                           
                              $myquerycou=$conn->query($sqlcou);
                           $mydaracou= $myquerycou->fetchAll()  ;
                           
                           $rows_foundcou = $myquerycou->rowCount(); 
                           
                           if($rows_foundcou=='0'){
                                echo'<div class="card-wrapper">
                                             <div class="media card-box">
                                             Product is not available to related search.
                                             </div>
                                             </div>';
                                
                            }
                           
                           ?>
                        <!--Favourite Coupons-->
                        <?php        foreach( $mydaracou as $rowcou ){
                           $rowId    = $rowcou["rowId"];
                           $short_title   = $rowcou["short_title"];
                           $discription   = $rowcou["full_title"];
                           $link = $rowcou["link"];
                           $product_image   = $rowcou["image"];
                           $company_name   = $rowcou["company_name"];
                           ?>
                        <div class="col-md-6">
                           <div class="fav-coupon">
                              <img src="<?=$product_image?>" alt="<?=$company_name?>" title="<?=$company_name?>" class="img-fluid mx-auto d-block">
                              <h6 class="text-truncate"><?=$short_title?> </h6>
                              <p class="mt-3 mb-4 d-para"><a class="context-menu"><?=$discription?></a></p>
                              <h5 class="deal-title mb-4" title="Get Code">Get Code</h5>
                              <a href="third-party/983" target="_blank" class="btn btn-secondary mt-3 d-grid" title="gearbest Coupons">Click</a>
                           </div>
                        </div>
                        <?php   } }?>
                        <!--Favourite Coupons-->
                        <div class="col-lg-12">
                           <!-- Paginations-->
                           <nav aria-label="Page navigation example">
                              <ul class="pagination justify-content-center pt-5">
                                 <?php        $sqlpa= "SELECT COUNT(*) FROM fav_master WHERE user_id='$user_id' AND user_type='user'";  
                                    $myquerypa=$conn->query($sqlpa);
                                    $row = $myquerypa->fetch(PDO::FETCH_BOTH);
                                    // do loop stuff
                                    $rows_foundpa = $myquerypa->rowCount();   
                                                  $total_records = $row[0];  
                                                if($total_records > 2){
                                        $total_pages = ceil($total_records / $limit);
                                       
                                        $k = (($pn+1>$total_pages)?$total_pages-1:(($pn-1<1)?2:$pn));  
                                        $val='3';
                                       $sr='&tab-id='.$val;
                                        $pagLink = "";
                                        if($pn>=2){
                                            echo "<li class='page-item'><a class='page-link' href='user-profiles/1".$sr."'> << </a></li>";
                                            echo "<li class='page-item'><a class='page-link' href='user-profiles/".($pn-1).$sr." '> < </a></li>";
                                        }
                                        for ($i=-1; $i<=1; $i++) {
                                            if($total_pages>=$k+$i && $k+$i!='0' ){
                                          if($k+$i==$pn){
                                            $pagLink .= "<li class='page-item active' ><a class='page-link' href='user-profiles/".($k+$i).$sr." '>".($k+$i)."</a></li>";
                                          }
                                          else{
                                            $pagLink .= "<li class='page-item'><a class='page-link' href='user-profiles/".($k+$i).$sr." '>".($k+$i)."</a></li>";  
                                          } }
                                        };  
                                        echo $pagLink;
                                        if($pn<$total_pages){
                                            echo "<li class='page-item'><a class='page-link' href='user-profiles/".($pn+1).$sr." '> > </a></li>";
                                            echo "<li class='page-item'><a class='page-link' href='user-profiles/".$total_pages.$sr." '> >> </a></li>";
                                        }  }  ?>
                              </ul>
                           </nav>
                        </div>
                     </div>
                  </form>
               </div>
            </div>
         </div>
      </div>
   </div>
</div>