0

how do i distinguish between $tags, i need to separate video with tags sexy and video with tags new. i need to put $tags = $sexy to be in div sexydiv and so is the other divs. the code i made below will only make each list. i need to make it look like youtube home page, where suggestion video and trending video are separate in 2 divs.

<div class="suggested-video">
<h2>Suggestion for you</h2>
    <ul>
    <?php
        global $connection;
        $sexy = "sexy";
        $new = "new";
        $query = "SELECT `videoname`,`username`,`videourl`,`uploaddate`,`duration`,`views`,`tags` FROM `videolist` WHERE `tags` = ? ";
        $stmt = $connection->prepare($query);
        $stmt->bind_param("s",$sexy);
        $stmt->execute();
        $stmt->store_result();
        if($stmt->num_rows > 0){
            $stmt->bind_result($videoname,$username,$videourl,$uploaddate,$duration,$views,$tags);
            while ($stmt->fetch()) {
                if($tags == $sexy){
                echo "
                    <div class='sexydiv'>
                    <ul>
                        <a href='video.php?watch=$videourl'>
                        <li>
                            <div class='leftside'>
                                <img src='' width='100%' height='100%' style='background-color: blue;' >                    
                            </div>

                            <div class='rightside'>
                                <h4>$videoname</h4>
                                <p>$username</p>
                                <p>$views views</p>
                                <p>$duration</p>    
                                <p>$tags</p>                
                            </div>

                        </li>
                        </a>
                    </ul>
                    </div>
                ";                      
                }
                if($tags == $new){
                echo "
                    <div class='newdiv'>
                    <ul>
                        <a href='video.php?watch=$videourl'>
                        <li>
                            <div class='leftside'>
                                <img src='' width='100%' height='100%' style='background-color: blue;' >                    
                            </div>

                            <div class='rightside'>
                                <h4>$videoname</h4>
                                <p>$username</p>
                                <p>$views views</p>
                                <p>$duration</p>    
                                <p>$tags</p>                
                            </div>

                        </li>
                        </a>
                    </ul>
                    </div>
                ";                      
                }

            }
        }
    ?>
    </ul>
</div>
freelixa
  • 111
  • 1
  • 6

0 Answers0