SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Member
    Join Date
    Jul 2000
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    I have created a database with *.ram files and I would like to keep track of how many times (column with each song in the db) each one is played i planned on using php to do this somehow but im not sure how i can do this without re-loading the page or poping up a window which I would rather not do...

    The way im looking at it is to call xxx.phtml?song_id=4 and xxx.phtml will add the stats to the db and call the *.ram file to stream but is this possible without reloading the page or opening a new page?

    Any help would be appreciated

  2. #2
    SitePoint Wizard
    Join Date
    Jul 1999
    Location
    Chicago
    Posts
    2,629
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sure. Simply UPDATE the database, then stream the file.

  3. #3
    SitePoint Member
    Join Date
    Jul 2000
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    what would trigger the update though without the page reloading the page and streaming the file? an 'onclick'?

  4. #4
    SitePoint Evangelist
    Join Date
    May 2000
    Location
    Canada
    Posts
    533
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the ram has to be "sent" to the user somehow, in the script which "sends" it, just update the database

    --------------------
    myPHPhost.com: we live, eat, sleep PHP

  5. #5
    SitePoint Member
    Join Date
    Jul 2000
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    that's what i was afraid of... i was trying to do it without reloading the page... but ill come up with something

    thanks 4 the help

  6. #6
    SitePoint Wizard
    Join Date
    Jul 1999
    Location
    Chicago
    Posts
    2,629
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can still do it without reloading the page. Send the browser a clearly-marked Real Movie file and it won't show it as an HTML page, it'll download it or let Real Player take over.

  7. #7
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    PHP can do this easily. Just do the following:

    <?php

    // update your database

    // Tell the browser you'll be sending it
    // a RAM file
    header("content-Type: audio/x-pn-realaudio");

    // Send the file
    include("ramfile.ram");

    ?>

    The above PHP script will look like a RAM file to the receiving browser, but will also update your database when it is loaded.


    ------------------
    -Kevin Yank.
    http://www.SitePoint.com/
    Helping Small Business Grow Online!


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
  •