On my site I have a page that uses a flash button to play an mp3. I want to keep track of how many times this button is pushed for plays (it also stops the song - dual use button). I have a field in the table for the individual mp3s called 'music_plays' it is an INT(11).

This is the code in the page where some mods would have to take place:

<div class='music_browse_item' style='width: 415px; float: left;'>
      <table cellpadding='0' cellspacing='0'>
      <tr>
      <td style='vertical-align: middle;padding-right: 3px;'>
        <div class='music_button'>
          <object width="17" height="17" data="./images/music_button.swf?song_url={$media_path}" type="application/x-shockwave-flash">
            <param value="./images/music_button.swf?song_url={$media_path}" name="movie" />
            <img width="17" height="17" alt="" src="noflash.gif" />
          </object>
        </div>
      </td>
      <td style='vertical-align: top; padding-left: 10px;'>
        <div style='font-weight: bold; font-size: 13px;'><a href='{$url->url_create("profile", $browse_music_list[browse_music_list_loop].user_username)}'>{$browse_music_list[browse_music_list_loop].music_title|truncate:45:"...":true}</a></div>
        <div class='music_browse_date'>
          {assign var='music_date' value=$datetime->time_since($browse_music_list[browse_music_list_loop].music_date)}{capture assign="updated"}{lang_sprintf id=$music_date[0] 1=$music_date[1]}{/capture}
          {lang_sprintf id=4000103 1=$updated 2=$url->url_create("profile", $browse_music_list[browse_music_list_loop].user_username) 3=$browse_music_list[browse_music_list_loop].music_uploader->user_displayname}
        </div>
        {if $user->user_exists && $user->level_info.level_music_allow_downloads}
        <div style='margin-top: 4px;'>
          <a type="application/force-download" href="{$media_path}">{lang_print id=4000095}</a>
        </div>
        {/if}
      </td>
      </tr>
      </table>
    </div>

I am not sure how to go about this.

The database table for this is:

CREATE TABLE IF NOT EXISTS `se_music` (
  `music_id` int(10) unsigned NOT NULL auto_increment,
  `music_user_id` int(10) unsigned NOT NULL default '0',
  `music_track_num` int(10) unsigned NOT NULL default '0',
  `music_date` int(11) NOT NULL default '0',
  `music_title` varchar(64) collate utf8_unicode_ci NOT NULL default '',
  `music_ext` varchar(8) collate utf8_unicode_ci NOT NULL default '',
  `music_filesize` bigint(20) unsigned NOT NULL default '0',
  `music_plays` int(10) NOT NULL,
  PRIMARY KEY  (`music_id`)

Somehow I need to track song plays, either using php... or most likely some AJAX. I am not sure so I hope someone has an idea.

Thanks in advance.

Btw this site uses SMARTY templating system. Not sure if that matters.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.