SitePoint Sponsor

User Tag List

Results 1 to 14 of 14
  1. #1
    SitePoint Guru
    Join Date
    Apr 2007
    Posts
    690
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How do I incorporate this into an output?

    How do I incorporate the following flash player into the last patch of php code?


    PHP Code:
    <embed src="http://www.jeroenwijering.com/embed/mediaplayer.swf" width="320" height="20" allowfullscreen="true" allowscriptaccess="always" flashvars="&file=/upload/peterjones_sunshine_lofi.mp3&height=20&width=320" /> 
    PHP Code:
    <?
    include 'dbconnect.php';

    $query  "SELECT id, name FROM upload";
    $result mysql_query($query) or die('Error, query failed');
    if(
    mysql_num_rows($result) == 0)
    {
        echo 
    "Database is empty <br>";

    else
    {
        while(list(
    $id$name) = mysql_fetch_array($result))
        {
    ?>
        <a href="download.php?id=<?=$id;?>"><?=$name;?></a> <br>
    <?        
        
    }
    }
    ?>

  2. #2
    SitePoint Wizard jimbo_dk's Avatar
    Join Date
    May 2005
    Location
    Singapore
    Posts
    1,261
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't really understand what you mean. You could place the Flash player code anywhere within an HTML portion of that code.
    Winners Respond. Losers React.
    Singapore Web Designer

  3. #3
    SitePoint Guru
    Join Date
    Apr 2007
    Posts
    690
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, I want the file from the database to be displayed in the flash player

  4. #4
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    What exactly are you wanting to do?
    Its a little vague.
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.


  5. #5
    SitePoint Guru
    Join Date
    Apr 2007
    Posts
    690
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay that output list all the files in the database...

    What I'm wanting it to do instead of outputting all the files in the database is output that embed file to play the files in the database all on the same page.

  6. #6
    SitePoint Wizard jimbo_dk's Avatar
    Join Date
    May 2005
    Location
    Singapore
    Posts
    1,261
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Still not really sure what you want, but I assume you want something like this:

    PHP Code:

    <?

    include 'dbconnect.php';
    $query  "SELECT id, name FROM upload";
    $result mysql_query($query) or die('Error, query failed');
    if(
    mysql_num_rows($result) == 0){
        echo 
    "Database is empty <br>";
    }else{
        while(list(
    $id$name) = mysql_fetch_array($result)){ ?>

       <embed src="http://www.jeroenwijering.com/embed/mediaplayer.swf" width="320" height="20" allowfullscreen="true" allowscriptaccess="always" flashvars="&file=/upload/<?php echo $name?>&height=20&width=320" /> 

    <?  }

    ?>
    Winners Respond. Losers React.
    Singapore Web Designer

  7. #7
    SitePoint Guru
    Join Date
    Apr 2007
    Posts
    690
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That does what I want it to, However..... The file isn't playing..

  8. #8
    SitePoint Evangelist bradical1379's Avatar
    Join Date
    Feb 2007
    Posts
    443
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Possibly because you are loading the player from someone else's site. Save the flv player to your site, don't leech.

  9. #9
    SitePoint Guru
    Join Date
    Apr 2007
    Posts
    690
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've already put the player on my site, but that's not it.. It's because it's displaying as <a href="">filename</a> it should just bring up the file to play.

  10. #10
    SitePoint Wizard jimbo_dk's Avatar
    Join Date
    May 2005
    Location
    Singapore
    Posts
    1,261
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    is the path correct:

    file=/upload/<?php echo $name; ?>

    try putting the full path.
    Winners Respond. Losers React.
    Singapore Web Designer

  11. #11
    SitePoint Guru
    Join Date
    Apr 2007
    Posts
    690
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    download.php?id=<?=$id;?>

    that's the full path to the file.

  12. #12
    SitePoint Wizard jimbo_dk's Avatar
    Join Date
    May 2005
    Location
    Singapore
    Posts
    1,261
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't know how your media player works, but you will probably need to send a FLV file, and not a PHP file (even though the PHP file will return the content).
    Winners Respond. Losers React.
    Singapore Web Designer

  13. #13
    SitePoint Guru
    Join Date
    Apr 2007
    Posts
    690
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    http://www.jeroenwijering.com/

    I'm using the flash player from there.

  14. #14
    SitePoint Wizard Hammer65's Avatar
    Join Date
    Nov 2004
    Location
    Lincoln Nebraska
    Posts
    1,161
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That player uses flashvars or an XML playlist to determine which files to play as most of those players do. You can use PHP to generate an XML file (that particular player takes three different XML formats including RSS). That would be a different file, that you would have to tell the player how to find through the query string or flashvars. The instructions for which are on that site.

    Do some research on flashvars and passing values to Flash movies. Also get a feel for how to generate XML with PHP as this is the best option for all the media players of it's type.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •