how to get data to html <ul> <li> </li> </ul> list from mysql database with php

Hi everybody, pls i need help here. i ve a video player and i want to populate video on it from mysql database, here is my code.

            <li data-thumb-source="assets/img/ddd.jpg" data-video-source="assets/video/ddd.mp4" data-poster-source="assets/img/ddd.jpg" data-downloadable="yes">
                <div data-video-short-description="">
                    <div>
                        <p class="minimalDarkThumbnailTitle">ddd</p>
                        <p class="minimalDarkThumbnailDesc">dddd.</p>

                    </div>
                </div>
                <div data-video-long-description="">
                    <div>
                        <p class="minimalDarkVideoTitleDesc">dddd</p>
                        <p class="minimalDarkVideoMainDesc">ddd</p>
                        <p>For more information about this please follow <a href="#" target="_blank">this link</a></p>
                    </div>
                </div>
            </li>
        </ul>

and i ve mysql database like this

 id | data-thumb-source | data-video-source | data-poster-source | minimalDarkThumbnailTitle | minimalDarkThumbnailDesc 

and php code to get the data from mysql

 <?php

                        $result= mysql_query("select * from video order by id  DESC" ) or die (mysql_error());
                        while ($row= mysql_fetch_array ($result) ){
                        $id=$row['id'];
                        ?>

but my video player is blank nothing to play. thanks in advance

Well, you are only showing your showing your database’s record ID. That does not place a link on the
page for the user to select from. You show a link for them to click on in the “more info” are of your display.
Also, you are showing us the list of one video display area. It does not show your video player.

Which video player are you use and how are you starting it? Are you saying that your data-video-source
starts the player? Normally, you have to place code for the player in the list so when they click on it, it go
and starts the video player. Do you have this live so we can peek at it to see what you are showing us?

As far as the code you showed us, normally all of the top code would be where you have the $id= line.
You would pull the entire data out for each video and show it inside the code for the displays. Is that what
is needed? If so, something loosely like this should work:
[php]

<?PHP $result= mysql_query("select * from video order by id DESC" ) or die (mysql_error()); while ($row= mysql_fetch_array ($result) ){ // *** Note: all of the data for one movie is inside of the $row[] array. Just display it where needed... ?>
  • " data-poster-source="assets/img/<?PHP echo $row['data-poster-source']; ?> data-downloadable="yes">

    <?PHP echo $row['minimalDarkThumbnailTitle'];?>

    <?PHP echo $row['minimalDarkThumbnailDesc'].

    dddd

    ddd

    For more information about this please follow this link

<?PHP } ?> [/php] NOTES: So, as you see, the WHILE loop you have is above and below your HTML code. In the places that you have data that should be replaced by database data, you ECHO it. Just stick PHP echo's in place as needed with <?PHP echo "somedata"; ?> Remember that the data is actually a field in your $row array...

Hope that helps. Hope that is what you are looking for… Good luck…

Sponsor our Newsletter | Privacy Policy | Terms of Service